Forum Moderators: open
I'm setting up a site and I want everyone who visits to pass through the main info page first, no matter what page they're linking to from outside of the site.
Welcome aboard allll, but consider that this is a Bad Idea from the outset. Remember what *you* want and what your *vistors* want are not likely to be the same thing. If I were looking for Widgets with Green Protuberances and I followed a link that brought me to an All About Widgets page, my impression would be that what I've landed on has nothing to do with Green Protuberances. I know what I want (or think I do) and I'm now confused and disoriented, so I will never be back.
The info page will set a cookie once they click an "I agree blah blah blah..."
This is the second faulty assumption, that someone who visits your site is going to take the time to read. You yourself have presented what they see: "Blah blah blah" which is answered by "I don't care, I want my Widget with Green Protuberances and you give me mumbo-jumbo." You simply can't force feed something to your visitors, especially something as dry as a user agreement.
Lastly a redirect of this sort is really going to hurt you in search engine indexing. A better approach, if a user agreement is required, is a login on all pages - but this too will kill you on search engines.
However if you persist, I would do as suggested, a server side simple script that reads and saves the REQUEST_URI environment variable, and presents the main page, then does the redirect or provides the link. This would not be dependent on Javascript and would help with search engine digestion.