Forum Moderators: phranque
<?php
//#add redirect in htaccess
//Options +Follow SymLinks
//RewriteEngine On
//RewriteBase /
//# Allow access from specific IP
//RewriteCond %{REMOTE_ADDR} !^000\.000\.000\.000
//RewriteCond %{REQUEST_URI} !^/503\.php [NC]
//RewriteRule .*/503.php [R,L]
header("HTTP/1.1 503 Service Temporarily Unavailable");
header("Status: 503 Service Temporarily Unavailable");
header("Retry-After: 3600"); //in seconds
//header("Retry-After: Sun, 5 Jan 2012 13:00:00 GMT"); //in gmt
?>
<!DOCTYPE html>
<!--[if IE 8]> <html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]> <html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<meta charset="utf-8"/>
<title>title</title>
<meta content="description" name="description" />
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<link href="//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css"/>
<link href="/somestyle.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="/favicon.ico"/>
</head>
<body>
some message
</body>
</html>
1 - The [R,L] means this is doing a 302 temporary to the page with the 503. Why? Wouldn't it be best to just do [L] straight to the 503?A 302 temporary is the better choice for a temporary change of the content you're updating. A 301 is for permanent changes.
ErrorDocument 503 /503.phpusing whatever you name your custom page in place of the generic 503.php filename as shown.
Wouldn't it be best to just do [L] straight to the 503?
RewriteRule ^ - [R=503,L]
2. How would one get around this? Would you have a separate folder ...
ErrorDocument 503 /whatevercustom503.php
and using RewriteRule ^ - [R=503,L] my question is why would I use a 302 in-between only to go to the 503?
RewriteRule ^ - [R=503,L]
RewriteRule ^whatevercustom503\.php - [L]
-- that is, the same rule you've already got in place to exempt your custom 403 page-- or you can attach a RewriteCond to the rule itself. Making an exemption package is easier, because you can put the rule at the very beginning of all your RewriteRules and then never think about it again.