Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

Thanks.

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.

add comment

2 Answers 2

up vote 2 down vote accepted
RewriteCond %{REMOTE_ADDR} != 192.168.1.0 #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} != 192.168.1.0 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
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
show 7 more comments

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

<?php
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
add comment

Your Answer

 
discard

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.