简体   繁体   English

使用htaccess隐藏地址栏上的维护页面

[英]Use htaccess to hide maintenance page on address bar

If I want to redirect all requests to a single page showing "maintenance" I do the following in htaccess 如果我想将所有请求重定向到一个显示“维护”的页面,请在htaccess中执行以下操作

RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=307,L]

But if I want to hide /maintenance.html from url http://www.example.com/maintenance.html in the address bar how can I do? 但是,如果我想从地址栏中的URL http://www.example.com/maintenance.html隐藏/maintenance.html怎么办?

It is not possible. 这不可能。
You can use: 您可以使用:

RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule !^maintenance\.html$ /maintenance.html [NC,L]

But in this case, there is no error code or redirection. 但是在这种情况下,没有错误代码或重定向。
If you want a redirection, there is necessarily a change of url in the address bar. 如果要重定向,则地址栏中的网址必须更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM