RewriteCond in .htaccess file gives me bad flag delimiters

Posted by Steven on Server Fault See other posts from Server Fault or by Steven
Published on 2010-11-02T20:35:14Z Indexed on 2011/02/13 23:27 UTC
Read the original article Hit count: 342

I'm upgrading a website and I use this .htaccess file to show maintenance page:

#MAINTENANCE-PAGE REDIRECT
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.0 # Bogus IP address for posting here
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.0 # Bogus IP address for posting here
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://www.mysite.no/maintenance.html [R=307,L]

This opens the maintenance page for all users except the two IP addresses I've added. They get an Internal Server Error. I've used thesame script on another site, and that worked fine.

Looking at the error log, I see the following:

/var/www/vhosts/mysite.no/httpdocs/.htaccess: RewriteCond: bad flag delimiters 

If I remove my .htaccess file, I can work with my site just fine.

My site is hosted on a VPN using CentOS 5.

How can I fix this problem?

© Server Fault or respective owner

Related posts about .htaccess

Related posts about rewriterule