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?


RewriteCond %{REMOTE_ADDR} != #your ip goes here
RewriteRule !^maintanence$ maintanence [L]
| 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
  • 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
  • Yes, I changed the IP in the example to my IP and still get a 500 Internal Server Error. – Tom Jun 12 '11 at 3:50
  • Hmm... that's interesting. Try this: RewriteCond %{REMOTE_ADDR} != #your ip goes here RewriteRule ^/$ construction.php [L] – esqew Jun 12 '11 at 4:01
  • 2
    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...

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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