apache_conf .htaccess维护重定向

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了apache_conf .htaccess维护重定向相关的知识,希望对你有一定的参考价值。

<?php
	/**
	 * https://moz.com/blog/how-to-handle-downtime-during-site-maintenance
     * https://github.com/h5bp/html5-boilerplate/blob/master/dist/404.html
	 */
	header('HTTP/1.1 503 Service Temporarily Unavailable');
	header('Status: 503 Service Temporarily Unavailable');
	header('Retry-After: 3600');

	/**
	 * .htaccess Rules

	#########################
	# MAINTENANCE MODE
	#########################

	# PUT INTO MAINTENANCE MODE
	RewriteCond %{QUERY_STRING} !allowed=1 [NC]
	RewriteCond %{REQUEST_URI} !^/maintenance.php [NC]
	RewriteCond %{REMOTE_ADDR} !(111.111.111.111|222.222.222.222|333.333.333.333)
	RewriteRule . /maintenance.php? [R=307,L]

	# DONE WITH MAINTENANCE MODE
	# RewriteCond %{REQUEST_URI} ^/maintenance.php [NC]
	# RewriteRule . / [R=307,L]

	 */
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Temporarily Down for Maintenance</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        * {
            line-height: 1.2;
            margin: 0;
        }
        html {
            color: #888;
            display: table;
            font-family: sans-serif;
            height: 100%;
            text-align: center;
            width: 100%;
        }
        body {
            display: table-cell;
            vertical-align: middle;
            margin: 2em auto;
        }
        h1 {
            color: #555;
            font-size: 2em;
            font-weight: 400;
        }
        p {
            margin: 0 auto;
            width: 280px;
        }
        @media only screen and (max-width: 280px) {
            body, p {
                width: 95%;
            }
            h1 {
                font-size: 1.5em;
                margin: 0 0 0.3em;
            }
        }
    </style>
</head>
<body>
    <h1>We're Working to Bring you a Better Website </h1>
    <p>Our site is currently unavailable, but we expect to be back up shortly.</p>
</body>
</html>
<!-- IE needs 512+ bytes: https://blogs.msdn.microsoft.com/ieinternals/2010/08/18/friendly-http-error-pages/ -->
#########################
# MAINTENANCE MODE
#########################

# PUT INTO MAINTENANCE MODE
RewriteCond %{QUERY_STRING} !allowed=1 [NC]
RewriteCond %{REQUEST_URI} !^/maintenance.php [NC]
RewriteCond %{REMOTE_ADDR} !(111.111.111.111|222.222.222.222|333.333.333.333)
RewriteRule . /maintenance.php? [R=307,L]

# DONE WITH MAINTENANCE MODE
# RewriteCond %{REQUEST_URI} ^/maintenance.php [NC]
# RewriteRule . / [R=307,L]

以上是关于apache_conf .htaccess维护重定向的主要内容,如果未能解决你的问题,请参考以下文章

apache_conf Bot Block .htaccess #htaccess #botblock

apache_conf 通过.htaccess(主.htaccess)保护wordpress网站

apache_conf [linux:.htaccess] apache的htaccess说明。 #linux #apache

apache_conf Seguridad .htaccess

apache_conf htaccess的

apache_conf 重定向htaccess