Displaying a "coming soon" image to users whilst I work on website redevelopment [duplicate]

Displaying a "coming soon" image to users whilst I work on website redevelopment [duplicate] - .htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, , , , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :







Possible Duplicate:

301 redirects for all except me






I've been developing a new version of my website for a while now, on a different directory to my currently-live website.



Shortly I'll be ready to move this directory to root and do a mass search and replace on the database dump.



However, for the short period whilst I take the old files offline and put the new site in place - and test it to make sure everything is working correctly - I'd like to put up a "coming soon, version 2 of the website!" image to all users apart from myself.



When I access the website, I want to be able to see everything as usual so that I can work on it.



What's the best way to go about this?



Thanks in advance,


Solution :

Based on this example you could use php to show one page to your ip address and another to everyone else.




PHP - this sends a 302 by default




<?
$visitor = $_SERVER['REMOTE_ADDR'];
if (preg_match("/192.168.0.1/",$visitor))
header('Location: http://www.yoursite.com/thank-you.html');
else
header('Location: http://www.yoursite.com/home-page.html');
;
?>



Htaccess 1




You can also achieve the same thing with htaccess, customising the 403 error page as you like.



order Deny,Allow
Deny from all
Allow from my.ip.add.ress

ErrorDocument 403 /forbidden.html



Htaccess 2 Rewrite Rule with 503 code




RewriteEngine on
RewriteCond %ENV:REDIRECT_STATUS !=503
RewriteCond %REMOTE_HOST ^192.168.0.1
ErrorDocument 503 /redirect-folder/index.html
RewriteRule !^s/redirect-folder$ /redirect-folder [L,R=503]



Status 301, 302 or 503




Also remember with this and other types of redirect that you should use a 302 redirect for temporary re-directions rather than a 301 which signals to Google it's a permanent re-direction you can also use a 503 'temporarily down' code to signal to search engines that they shouldn't index your holding page.



Check the list of status codes to choose the most appropriate.



Think I've found a link on here which I should've noticed in the first place:



301 redirects for all except me



I suspect this will do the trick for me perfectly.



Why not develop on a local server and when ready commit it to your live site? Are you making significant database changes or are you only doing search and replace to update the path from your sub folder development area to the root folder? Using redirects and coming soon pages might affect your rankings in Google. If you can avoid it you should and find another way to update without having to redirect everyone with a coming soon page.


Additionally, if you would like to do some further testing, give the htaccess tester tool a try. It allows you to specify a certain URL as well as the rules you would like to include and then shows which rules were tested, which ones met the criteria, and which ones were executed.

Comments

Popular posts from this blog

Rewrite in Mediawiki, remove index.php, .htaccess

.htaccess rewrite wildcard folder paths from host

Using .htaccess to set a cookie and 301 redirect