Forum Moderators: phranque
i have googled about query strings and still can't find a solution, i was hoping someone here could point me in the right direction :)
i have the URL's
http://proxy.example.com/errors/blocked.html?Time=24/Apr/2008:15:08:42%20+1000&ID=0002943691&
Client_IP=10.0.0.13&User=-&Site=example.au&URI=mddail/&Status_Code=503&Decision_Tag=OTHER&
URL_Cat=nc&WBRS=dns&DVS_Verdict=0&DVS_ThreatName=-
http://proxy.example.com/errors/blocked.html?Time=30/Apr/2008:14:38:25%20+1000&ID=0004244428&
Client_IP=10.0.0.13&User=-&Site=example.com.au&URI=&Status_Code=403&Decision_Tag=BLOCK_WEBCAT-DefaultGroup&
URL_Cat=Game&WBRS=-&DVS_Verdict=-&DVS_ThreatName=-
i would like to use mod_rewrite to redirect to a static page that represents the error based on &URL_Cat=xyz&WBRS=xyz
im trying
rewriteEngine on
RewriteBase /errors/
rewriteCond %{query_string} ^URL_Cat=nc&WBRS=dns$
rewriteRule ^errors$ [proxy.example.com...] [R=301,L]
rewriteCond %{query_string} ^URL_Cat=adult&WBRS=$
rewriteRule ^errors$ [proxy.example.com...] [R=301,L]
but obviously it isn't working for me, Id appreciate any help you can give me with this and thank you in advance
cheers
Steve
[edited by: jdMorgan at 12:28 am (utc) on May 8, 2008]
[edit reason] de-linked and tidied-up URLs [/edit]
RewriteEngine on
#
RewriteCond %{QUERY_STRING} &?URL_Cat=nc&WBRS=dns&?
RewriteRule ^errors/ http://proxy.example.com/errors/pagenotfound.html? [R=301,L]
#
RewriteCond %{QUERY_STRING} &?URL_Cat=adult&WBRS=
RewriteRule ^errors/ http://proxy.example.com/errors/adult-education.html? [R=301,L]
Jim
[edited by: jdMorgan at 12:29 am (utc) on May 8, 2008]
but be aware that if you return a 301-Moved Permanently status code to a search engine, that it will not handle that as an error, and will continue to request the "bad" URL and list it in search results.
The way I usually handle this is to make sure I set the header with PHP (or a scripting lang.) to make sure after the 301 is served, SEs are served a proper Error message, rather than a 301 to a 200.
It is not necessarily ideal, but should get the job done. The thing to avoid is a 301 to a 200, and absolutely avoid a 301 to a 302 (incorrect ErrorDocument reference) to a 200 page found.