Search Engine Optimization/htaccess redirect

Advertisement


Question
Hello,
I need help with this .htaccess redirect. I am upgrading my website and need everyone else to be redirected to a maintenance page while only I have access to the site to upgrade it.
Do you know if I am doing something wrong with this htaccess redirect?

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^000\.000\.000\.000
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteRule .* /maintenance.html [R=302,L]

I know I need my own IP address instead of the zeros, but when I put my IP address in there, it doesn't work. When I take the whole address line out, it works, but then I can't work on my site. This code is supposedly a straight-up working copy-and-paste, but it really isn't, unless i'm doing something wrong with the IP line.

Thank you for any help.

Answer
Looks like you are missing RewriteBase /

Full example:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1
RewriteCond %{REQUEST_URI} !/coming-soon\.html$
RewriteRule .* http://www.example.com/coming-soon.html [R=302,L]

Search Engine Optimization

All Answers


Answers by Expert:


Ask Experts

Volunteer


Kelly Darwin

Expertise

Search Engine Optimization, understanding how to make your web site search engine friendly and understanding the importance of how your web site it written and constructed.

Experience

We have over 100 clients internationally. Many that we have performed Search Engine Optimization (SEO). I have been performing SEO for over 6 years. Specializing in Google, MSN and Yahoo! organic searches. Examples of our results can be viewed on our website.

Organizations
Owner Seriously Creative

Publications
Numerous newsletters and weblogs.

Education/Credentials
Graduated from a Programming and Computer Systems Management.

Past/Present Clients
We have over 100 clients internationally. Most of our clients can be viewed on our website at http://www.seriouslycreative.ca

©2016 About.com. All rights reserved.