【问题标题】:Use htaccess to hide maintenance page on address bar使用 htaccess 隐藏地址栏上的维护页面
【发布时间】:2017-11-08 16:24:56
【问题描述】:

如果我想将所有请求重定向到显示“维护”的单个页面,我在 htaccess 中执行以下操作

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

但是如果我想在地址栏中隐藏 url http://www.example.com/maintenance.html 中的 /maintenance.html 怎么办?

【问题讨论】:

    标签: apache .htaccess mod-rewrite maintenance


    【解决方案1】:

    这是不可能的。
    您可以使用:

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

    但在这种情况下,没有错误代码或重定向。
    如果要重定向,地址栏的url一定要改。

    【讨论】:

      猜你喜欢
      • 2013-12-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-11
      • 1970-01-01
      • 2013-07-10
      • 2011-05-06
      相关资源
      最近更新 更多