Page 1 of 1

Apaches mod_rewrite and HTTP_RERERER

Posted: Wed Jan 11, 2006 4:17 pm
by visionmaster
Hello,

Searching for a product in the search machine google can lead the user to a webpage http://www.mywebpage.de/productcalogue_1.html

If the user clicks such a link, he should be directed to the another webpage. I was thinking of using %{HTTP_RERERER} to analyze the referer. Further analyzing the referer, one can find out the exact search word the user entered in google's search mask. ( q=searchword)

I'm having difficulties implementing a redirection using Apaches mod_rewrite. How I can I "grab" %{HTTP_RERERER} , then "remember" that complete string and find out what q= is holding using %{QUERY_STRING}? And finally redirect to a specific page I want.

Or is it not possible to implement the above procedure using mod_rewrite?


Thanks a lot for your time and help!

Posted: Wed Jan 11, 2006 4:54 pm
by feyd
why not have php handle that? $_SERVER['HTTP_REFERER'], parse_url(), explode() two times.