Jump to content

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.

 

 

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.