Forum Moderators: phranque
Example:
I do a search on big search engine... the search term includes the word *widget*, but it's going to the wrong page ( don't ask me how, as the keyword *widget* isn't even mentioned/linked on that page )... how can I redirect it to the correct page it's supposed to go to if *widget* is included in the search/referer?
Jim? :)
But generically, a simple solution for G, Y, and MSN/Live might be something like:
RewriteCond %{HTTP_REFERER} search[^?]\?([^&]+&)*(as_q¦as_epq¦q¦p¦va¦what)=([^&+%]+(\+¦\%2b¦\%20))*big(\+¦\%2b¦\%20)blue(\+¦\%2b¦\%20)widget(\+¦\%2b¦\%20¦&)?
RewriteRule ^wrong_page\.html http://www.example.com/right_page.html [R=302,L]
Likewise, I'm enforcing the "boundaries" of the "q=" names to avoid ambiguity.
I use a 302 redirect, because you certainly don't want the page replaced in the search listings, and also to avoid cache-related problems, since the page-replacement function is dynamic and temporary.
The code is untested; You'll likely need to play with it to get it working exactly the way you want.
Jim
[edited by: jdMorgan at 3:26 pm (utc) on Mar. 29, 2007]