Forum Moderators: phranque
root ---> www.MySite.abc
sub dir > www.MySite.abc/SubDirectory
My main site requires a login before the page data will appear (private site). Once logged in, I wish to have a link on my main root web site which links to the pages in the sub directory. But - I do not want anyone to be able to open a browser directly to the sub directory. They 'must' click the link on the root site, or at least enter from within the root folder (somehow?).
Is there a way with .htaccess to prevent direct entry into the sub directory, or at least somehow limit entry to those who have passed through the root?
Thanks (hope that makes sense) :)
Another option is to set a cookie in a visitor's browser when they go to a root page, then if someone arrives at a subdir page without a cookie, you know they haven't been to the root level yet, and you can redirect them there. Does this sound like what you're looking for?
The proper solution would be to edit your CMS software, which would work even if Javascript were turned off, and would work before unapproved users ever saw any restricted content. You'll probably have to hire a programmer to do this, unless you want to spend some time learning the language your CMS is written in. I assume it's written in something like PHP, Perl, or ASP.net? I imagine it would be easy to find someone to do this for $50 or less. (Not me though, I have enough work.)