Welcome to WebmasterWorld Guest from 50.19.53.104

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Search Engine Friendly Temporary Maintenance Page

Allow sub domains and some folders

     

abushahin

2:21 pm on May 29, 2012 (gmt 0)

5+ Year Member



Hello,
Just wondered if its possible to take the site down for maintenance but still allow sub domains and some folders?

Im found something on the www need help amending


RewriteEngine on

RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000

RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]

RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]

RewriteRule .* /maintenance.html [R=302,L]


ANy help mush appreciated!

motorhaven

4:21 pm on May 29, 2012 (gmt 0)

10+ Year Member



Even though Google and other crawlers should recognize the 302 as a temporary relocation I like to avoid sending any page redirection headers.

I send out a "503 Service Unavailable" code instead, which indicates the server is down or undergoing maintenance. Instead of redirecting it to a HTML page I recommend you yend it to a php script which gives the maintenance message:

RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
RewriteCond %{REQUEST_URI} !/maintenance.php$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.php [L]

Then the maintenance.php script:

<?
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Retry-After: 600'); // Retry after 10 minutes
echo 'Your maintenance message here.";
?>

g1smd

9:11 pm on May 29, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The 503 status is the correct one to use.

Downtime of only a few hours is no worry whatsoever.
Google will be back in there in short order soon after the stated expiry time.

abushahin

10:41 pm on May 30, 2012 (gmt 0)

5+ Year Member



Thanks for the correct error code. Is there anyway to allow some folders though using htaccess whilst redirecting all root visiters?

g1smd

10:54 pm on May 30, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Be clear, this is NOT a redirect. Redirects return a 30x status code.

This is a method of returning an alternative status code and a human-readable message for some vistors.

Use a series of RewriteCond conditions to select which vistors and/or which user agents see the message and which do not and/or which paths and files are accessible and which are not.

motorhaven

11:07 pm on May 30, 2012 (gmt 0)

10+ Year Member



Noticed a mistake in my code. The echo should end with a single ' quote, not a double " quote.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month