Help with Apache rewriteengine rules

Posted by Vinay on Server Fault See other posts from Server Fault or by Vinay
Published on 2011-01-11T03:18:52Z Indexed on 2011/01/11 3:56 UTC
Read the original article Hit count: 303

Hello - I am trying to write a simple rewrite rule using the rewriteengine in apache. I want to redirect all traffic destined to a website unless the traffic originates from a specific IP address and the URI contains two specific strings.

RewriteEngine On
RewriteLog /var/log/apache2/rewrite_kudithipudi.log
RewriteLogLevel 1

RewriteCond %{REMOTE_ADDR} ^199\.27\.130\.105
RewriteCond %{REQUEST_URI} !/StringOne [NC, OR]
RewriteCond %{REQUEST_URI} !/StringTwo [NC]
RewriteRule ^/(.*) http://www.google.com [R=302,L]

I put these statements in my virtual host configuration. But the rewriteengine seems to be redirect all requests, whether they match the condition or not. Am I missing something? Thank you.

  • Vinay.

© Server Fault or respective owner

Related posts about apache2

Related posts about mod-rewrite