RewriteRule ^(.*) http://%{REMOTE_ADDR}/go_away [R=301,L]

My /.htaccess contains

RewriteEngine On
RewriteCond %{HTTP_REFERER} ^(http://www.)[a-z]+-[a-z]+-[a-z]+- [NC]
RewriteRule ^(.*) http://%{REMOTE_ADDR}/go_away [R=301,L]


Which I lifted from somewhere.  I have another rewrite rule to steer IE users to a friendly notice.  However the visitor log uses code 200.   How can I change this next rule to use an code other than 200 to make finding them in logs easier?




RewriteEngine on
RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/4.0.*$ [NC]
RewriteRule ^(.+) /errors/uhohie.shtml  [L]


Because both of these next sets causes server-500 errors


RewriteEngine on
RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/4.0.*$ [NC]
RewriteRule ^(.+) http://mypretendhost.com/errors/uhohie.shtml  [R=204,L]

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT}  ^Mozilla/4.0.*$ [NC]
RewriteRule ^(.+) /errors/uhohie.shtml  [304,L]






paradoxlossAsked:
Who is Participating?
 
caterham_wwwCommented:
> How can I change this next rule to use an code other than 200 to make finding them in logs easier?

you should see a 301 statuscode for your 1st rewrite Rule. If you see a 200 and your site instead of that you're redirecting to, your rule did not match.


> Because both of these next sets causes server-500 errors

[R=204] is an invalid flag, [304,L] must be - if possible - [R=304,L]
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.