Forum Moderators: phranque
This is what I have so far (RewriteEngine On) and it has no effect. I figured I would start out with as specific a URL as I could then try to pare it down to wildcards(?) once it's working. Unfortunately that hasn't happened.
RewriteCond %{HTTP_REFERER} ^http://searchdomain\.com/results\.aspx?FORM=BLAH&srch_type=0&q=[-.]word[-.]$
RewriteRule /* [mydomain.com...] [R,L]
Side question: Is there a broader method that would work for all SE domains? As of now this is only a problem with one...
RewriteCond %{HTTP_REFERER} ^http://(www\.)?searchdomain\.com/results\.aspx.*[?&]q=([^&]+)
You would follow this with a final RewriteCond and RewriteRule something like:
RewriteCond %2 ^(word1¦word2¦word3) [NC]
RewriteRule .* http://www.example.com/page.html [R=302,L]
There are too many formats used by search engines to solve the problem with just one RewriteCond; Some use "p=", some use "qkw=", some use "query", etc. Therefore, I'd recommed handling this problem on an "as-needed" basis.
Replace the broken pipe "¦" characters with solid pipe characters (usually Shift-\) before use. Posting on this forum modifies them.
Jim
Haven't quite got it working yet; Does the "+" in q=([^&]+) assume the presence of "+" in the query string?
Please see the references cited in our forum charter.
Pretty much what I've been doing, albeit at a sloth's pace!
What I currently have (caret removed from second RewriteCond):
RewriteCond %{HTTP_REFERER} ^http://(www\.)?search\.domain\.com/results\.aspx.*[?&]q=([^&]+)
RewriteCond %2 (word¦word) [NC]
RewriteRule .* http://www.example.com/page.html [R=302,L]Apparently I've created a loop because the search result page hangs when the listing is clicked and my server log shows repetitive 302s to the redirect page. Error log shows nothing. Checking to see if there are any obvious conflicts with other rules.
Thanks.
[edited by: jdMorgan at 11:25 pm (utc) on May 27, 2005]
[edit reason] Example.com [/edit]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?search\.domain\.com/results\.aspx.*[?&]q=([^&]+)
RewriteCond %2 (word¦word) [NC]
RewriteRule [b]!^page\.html$[/b] http://www.example.com/page.html [R=302,L]
Jim