Apaches mod_rewrite and HTTP_RERERER

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
visionmaster
Forum Contributor
Posts: 139
Joined: Wed Jul 14, 2004 4:06 am

Apaches mod_rewrite and HTTP_RERERER

Post 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!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not have php handle that? $_SERVER['HTTP_REFERER'], parse_url(), explode() two times.
Post Reply