Jump to content

.htaccess blocking user-agents results in 500 error


Bottyz

Recommended Posts

Hi all,

 

I've tried numerous different methods of blocking user agents with my htaccess but none seem to result in a 403 but always a 500 response!

 

The section of my htaccess in question looks like so:

 

RewriteEngine on

DirectoryIndex index.php index.html

ErrorDocument 400 /400.php
ErrorDocument 401 /401.php
ErrorDocument 403 /403.php
ErrorDocument 404 /404.php
ErrorDocument 500 /500.php

RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^Morfeus [NC]
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^Toata [NC]
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^Plesk [NC]
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^Sosospider [NC]
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^WhiteHat
RewriteRule ^.* - [F,L]
RewriteCond %{HTTP_USER_AGENT} ^ZmEu [NC]
RewriteRule ^.* - [F,L]

 

I added in the extra lines of RewriteRule ^.* between each user agent to see if it was a problem with having the list of user-agents and then one rewrite rule at the bottom. But this doesn't appear to be the case.

 

All of the above user agents need to be matched to the first part of the user-agent string as some finish with extra words, like Sosospider is actually Sosospider+. Hence no $ after the strings.

 

The webserver is linux based with apache and cpanel installed. I have spoken with my webhosts and they don't have any idea why other than it could be a syntax issue. The 500 error document doesn't get pointed to either, it always defaults to 500.shtml which doesn't exist on the server. That though seems to be a cpanel issue.

 

Any help as always is much appreciated.

 

 

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.