Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

Posted on 2005-05-16
Medium Priority
Last Modified: 2008-03-03
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]

Question by:paradoxloss
1 Comment
LVL 27

Accepted Solution

caterham_www earned 2000 total points
ID: 14020880
> 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]

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses
Course of the Month13 days, 13 hours left to enroll

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question