Forum Moderators: phranque
The following 2 ways give me server errors.
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bullseye #Looks to be a B2B bot. [intelliseek.com...]
RewriteRule /* sendthemhere.htm [R,L]
or
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bullseye
#Looks to be a B2B bot. [intelliseek.com...]
RewriteRule /* sendthemhere.htm [R,L]
But the following works fine.
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^attach [OR]
RewriteCond %{HTTP_USER_AGENT} ^Bullseye
RewriteRule /* sendthemhere.htm [R,L]
What am I doing wrong? THANKS!
Well, that's strange...
Your first version won't work because comments are not allowed at the end of a line. But the second version should be OK.
Do you get any useful indication of the problem from your server error log file?
Your RewriteRule causes an external redirect, which many "bad" user-agents won't follow. You might just as well do an internal redirect, which simply substitutes the new content for that which was requested:
RewriteRule /* /sendthemhere.htm [L]
Note that this will only work for requests of .htm files - you can't redirect a request for a .gif file to a .htm file...
If you really want to cover all possible file types, I'd suggest a simple 403-Forbidden response:
RewriteRule .* - [F]
You may wish to allow even bad guys access to your robots.txt and custom 403 page:
RewriteRule!^(robots\.txt¦my403\.htm)$ - [F]
The alternative is to create an "alternate" file for each possible requested filetype, and redirect each type request to it's own alternate:
RewriteRule \.(gif}jpe?g¦png¦html?¦pdf¦mp3¦mpe?g)$ /sendthemhere.$1 [L]
...where $1 on the right takes on the content of anything that matches in the parenthesized pattern on the left; So, for example, anything.jpg gets redirected to sendthemhere.jpg.
One final note... Posting on this board modifies the "¦" characters used above. Edit these to replace them with the solid vertical pipe character from your keyboard before use!
I still can't say why your comment on a separate line causes problems, though... Check your error log.
Jim