【发布时间】:2015-12-23 01:27:09
【问题描述】:
用于 apache 服务器的 htaccess 导致我所有的 IIS 服务器在维护时都将关闭。我需要将所有内容重定向到错误 503 自定义页面并返回 503 错误,但我不知道正确的解决方案。
RewriteEngine on
RewriteBase /
ErrorDocument 503 /503.html
RewriteRule ^.*$ - [L,NC,R=503]
这个结果变成这样:(响应不是我的自定义响应)
Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
再试一次:
RewriteEngine on
RewriteBase /
ErrorDocument 503 /503.html
RewriteRule ^(?!503.html)$ - [L,NC,R=503]
给我我需要的东西,但只为 www.domain.com 和所有其他页面给我 404(除了给我 200 的 www.domain.com/503.html)。
所以我需要将除 domain.com/503.html 之外的每个页面重定向到自定义 503 错误页面并返回错误代码。
【问题讨论】:
标签: apache .htaccess mod-rewrite errordocument