Skip to main content
Use example domain, use relevant tags
Source Link
Stephen Ostermiller
  • 99.4k
  • 18
  • 141
  • 364

Given a homepage at domain.com (e.g., domain.com/index.htmlhttps://example.com/), I want:

  1. outside requests to only be able to visit the homepage and no subpages
  2. that homepage to successfully redirect visitors to a subpage (for example, domain.com/page1.htmlhttps://example.com/page1.html)

I can accomplish #2 with some simple JavaScript and window.location.href = domainexample.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:

  1. outside visitor visits domain.com/index.htmlhttps://example.com/
  2. domain.com/index.htmlhttps://example.com/ redirects visitor to, for example, domain.com/page1.htmlexample.com/page1.html
  3. any attempt to visit domain.com/page1.htmlexample.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.

Given a homepage at domain.com (e.g., domain.com/index.html), I want:

  1. outside requests to only be able to visit the homepage and no subpages
  2. that homepage to successfully redirect visitors to a subpage (for example, domain.com/page1.html)

I can accomplish #2 with some simple JavaScript and window.location.href = domain.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:

  1. outside visitor visits domain.com/index.html
  2. domain.com/index.html redirects visitor to, for example, domain.com/page1.html
  3. any attempt to visit domain.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.

Given a homepage at domain.com (e.g., https://example.com/), I want:

  1. outside requests to only be able to visit the homepage and no subpages
  2. 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:

  1. outside visitor visits https://example.com/
  2. https://example.com/ redirects visitor to, for example, example.com/page1.html
  3. 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.

Source Link
mix
  • 195
  • 1
  • 5

How to block access to all but homepage unless that access comes from the homepage?

Given a homepage at domain.com (e.g., domain.com/index.html), I want:

  1. outside requests to only be able to visit the homepage and no subpages
  2. that homepage to successfully redirect visitors to a subpage (for example, domain.com/page1.html)

I can accomplish #2 with some simple JavaScript and window.location.href = domain.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:

  1. outside visitor visits domain.com/index.html
  2. domain.com/index.html redirects visitor to, for example, domain.com/page1.html
  3. any attempt to visit domain.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.