Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The title pretty much says it all.

I want to direct all traffic to an under construction page except for traffic originating from my IP address so I can move a large development site into production and tweak a few things along the way.

Any way to do this in .htaccess?


share|improve this question

migrated from stackoverflow.com Jun 12 '11 at 4:25

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted
RewriteCond %{REMOTE_ADDR} != #your ip goes here
RewriteRule !^maintanence$ maintanence [L]
share|improve this answer
If I do this I get a 500 internal server error: RewriteEngine On RewriteCond %{REMOTE_ADDR} != RewriteRule construction.php [L] – Tom Jun 12 '11 at 2:53
Did you edit it for your IP address like I have annotated??? – esqew Jun 12 '11 at 2:57
Yeah, and even when I don't change the IP I don't get redirected to the under construction page, I get a 500 Internal Server error instead. – Tom Jun 12 '11 at 2:59
No, did you change it to YOUR IP that you're connecting to the server from?? – esqew Jun 12 '11 at 3:24
Check the error.log of your Apache httpd. I guess that mod_rewrite simply hasn't been loaded or that AllowOverride forbids the use of .htaccess files. – joschi Jun 12 '11 at 9:29

in .htaccess, i am nt sure bt with php u can do this... Create index.php using following code

header ("Location:./under-construction/");

keep this index.php file in public_html folder and your users will directly redirected to under construction page and u can check ur work directly entering ur page for exampale: xyz.com/demo/ or if your real page file(index.php) and should be located in same folder public_html than rename ur real page name frm index.php to demo.html for a while...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.