Given a homepage at domain.com (e.g., https://example.com/
), I want:
- outside requests to only be able to visit the homepage and no subpages
- that homepage to successfully redirect visitors to a subpage (for example,
https://example.com/page1.html
)
I can accomplish #2 with some simple JavaScript and window.location.href = example.com/page1.html
. But for #1, is there a way to reject access to internal pages if the referrer is coming from my domain.com? Basically the flow I'm looking for is:
- outside visitor visits
https://example.com/
https://example.com/
redirects visitor to, for example,example.com/page1.html
- any attempt to visit
example.com/page1.html
directly fails with a 404
I get that this may all seem nonsensical in terms of what it does. That's by design. I want a website that sends visitors to internal pages, but only if they get there through the homepage redirecting them to it.
.htaccess
? I'm not sure that this can be accomplished using it. Can you tell us more about the site? What you're asking for might make sense in some context, but I can't figure it out. This would be an SEO disaster, for example. Do you have server side scripting like PHP that you can build this logic?.htaccess
(and perhaps a cookie?), however, you still seem to be in the process of design and what you describe sounds more like a single-page-application (as you suggest). A single URL (the homepage) from which you conditionally serve content based on some criteria. No redirects, no additional URLs, no "access control". (?)