Using PHP to redirect external visitors (outside of my domain) to a central index.htm page...
Posted on 2004-08-17
I'm trying to figure out how to redirect visitors to my web site who may get referred thru a search engine to my main index.htm page first, and then they can launch the page they want from there. I intend on running this check on each of my pages. (A very small site with only 9 pages, so they won't have a hard time finding the page they are looking for.)
I tried using the "getenv("HTTP_REFERER"); function, but didn't have much luck - I am sure it was my syntax. Here is what I need to be able to do:
1. Check referring page
2. If referring page is from any page on my domain, allow the target page to load.
3. If referring page is external from my domain, automatically redirect the visitor to index.htm
4. It must work on all current browsers.
5. Any additional info on how this may effect a search enging crawling my site would be appreciated.
Working sample code will get the points. Thanks as always, experts!