Rewrite Rule for Down Site Pages

I tried to install this .htaccess to notify my users about site maintenance. It seems that the first [L] is not working, and the second is rewriting everything.

How do you guys make site maintenance reports?

RewriteEngine on

RewriteRule ^s/down$ index.html [L]
RewriteRule ^(.*)$ http://metaward.com/s/down [R=302,L]
+5
source share
5 answers

This seems to work (but I have to set the status code in PHP)

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/static/.*$
RewriteCond %{REQUEST_URI} !^/media/.*$
RewriteRule .* down.php [L]

and in down.php

<?php
header('HTTP/1.1 503 Service Temporarily Unavailable',true,503);
?>

Any problems with this? My main problems are what the user sees (which is why I save static content) and which search engines see (status code 503).

+5
source

. 503 status code .

RewriteCond %{ENV:REDIRECT_STATUS} !=503
RewriteRule ^(.*)$ /503.html [R=503,L]
ErrorDocument 503 /503.html

, Apache 2.x R, 3xx.

+6

RewriteRules, -, , :

RewriteCond %{REMOTE_ADDR} !=MY_IP_ADDRESS
RewriteRule    ^$  /down.html  [L]
RewriteCond %{REMOTE_ADDR} !=MY_IP_ADDRESS
RewriteRule    [^/down.html$]  /down.html  [L]

( , "", ... ( ) , )

, down.html, down.html - , : , ,

ANd, , .

+1

Apache ruby ​​ rails.

, ,

ProxyPass /custom-errors !
ErrorDocument 503 /custom-errors/maintenance-message.html

httpd.conf , : [ Apache]/htdocs/custom-errors/maintenance-message.html .

0

I do not see anyone using the Retry-After header. I read (but I no longer have the link since I read this a while ago) that you should use 503 in combos with Retry-After n (n = number of seconds to try again; 3600 is an hour). If you use 503 and Retry-After in a combo, especially on your robots.txt / sitemap file, it should not ruin the links and page rank for SEO unless you leave it this way for a long time.

0
source

All Articles