.htaccess – Redirect Everyone But You
Lets begin with the basics. Create a text file and name it .htaccess . Then, lets add some text:
Options +FollowSymlinks
Rewrite Engine on
RewriteCond %{REQUEST_URI] !/maintenance.html$RewriteRule $ /maintenance.html [R=302,L]
Save your file and lets upload it to the root directory. In other words, it should appear here: www.yourwebsite.com/.htaccess
Once its been uploaded whenever you go to the website it should automatically redirect you and everybody else to maintenance.html. If this page doesn’t exist, you’ll get an error but this is only the test. Once we know the file is working, lets add this extra line right after the REQUEST_URI line:
RewriteCond %[REMOTE_HOST] !^12\.34\.56\.78
Of course you would replace the IP with your own (find it at www.ipchicken.com ). Save the file and reupload it. It should now look like the following:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_HOST} !^12\.34\.56\.78RewriteRule $ /maintenance.html [R=302,L]
It’s as simple as that. If you want to allow more than one IP, you can just duplicate the REMOTE_HOST line as many times as you want with your new IP addresses. Upload to the root directory and you’re good to go! Good luck!










Cool tutorial!
I have one question though, I am thinking about taking down my website for maintenance. Can I make a custom display when other people try to get on it? Like, “Website is under maintenance. Please try again later”?
Micah
Nevermind, figured it out
Leave your response!
Amazing Death Cab for Cutie video by Ross Ching
Death Cab for Cutie - Little Bribes from Ross Ching.
Short Bio
Categories
Admin Panel
Check These Out
Tag Cloud
504 dymes 2008 action adventure agency aim alabama animation annoy answers aol atlantic audio bahamas bermuda bill blink 182 bodyworks category 5 chiropractic choke chuck co-workers code comedy design gustav hanna hurricane ike Inspiration logo louisiana photoshop pop portfolio punk storm Tropical tropical storm video vista website Wordpress wpmu
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.