Redirection only for direct access to a section


I have a website with a given section. I need to implement a redirection just for the users visiting the section directly through the Google link. I mean that the users would be able to visit the section through the internal links and sitemap, but not directly.

Is it possible through htaccess?

Many thanks.

htaccess and PHP can both attempt to do the same thing, which is to read the HTTP_REFERER and if it’s not internal, redirect.

This is not a foolproof system though, as some browsers will not send referrer information with requests, or users might disable that functionality if they’re particularly skittish about their information.
For example, it took me 10 seconds on google to find out how to disable the referrer in Firefox.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.