i want make specific 403 message (or page) 1 specific set of rewritecond in .htaccess file in apache 2.2. have never seen done, seems though should possible.
the relevant part of .htaccess access file looks this:
rewriteengine on rewritecond %{http_user_agent} ^baiduspider.* [nc] rewriterule .* - [f]
as can see, block them access if user agent matches rewritecond.
a little more details
this works great blocking offending bots, run annoying problem. our site accessed many technical people. lot of programming on own , use browser plugins "user agent switcher".
i want provide more meaningful message in specific instance. know change "user agent switcher" normal browser. rather providing normal 403 page, friendlier message here.
i know pass our scripting engine, pull out user agent , pass custom headers, seems might have more elegant .htaccess solution.
so... why not redirect custom 403 file? , in html file put want. bot sent there too.
rewriteengine on rewritecond %{http_user_agent} ^baiduspider.* [nc] rewritecond %{request_uri} !^/errorpages/403.html [nc] rewriterule ^.* /errorpages/403.html [r,l]
Comments
Post a Comment