【问题标题】:Redirect non-existing subpage to another page using .htaccess使用 .htaccess 将不存在的子页面重定向到另一个页面
【发布时间】:2012-10-29 17:23:42
【问题描述】:

我想重定向:

domainname.com/instalator(不存在)到 domainname.com/install

使用 .htaccess。我该怎么做?

【问题讨论】:

    标签: .htaccess redirect http-redirect


    【解决方案1】:

    使用 mod_alias:

    Redirect 301 /instalator /install
    

    使用 mod_rewrite:

    RewriteEngine On
    RewriteRule ^/?instalator(/.*)$ /install$1 [L,R=301]
    

    如果您有其他将/install 映射到资源或某种路由器的重写规则,那么您需要坚持使用 mod_rewrite 并且 您必须将上述规则放在 之前您的任何路由规则

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-10
      • 2014-09-01
      • 1970-01-01
      • 2012-09-09
      • 2013-02-08
      • 1970-01-01
      • 2016-12-19
      相关资源
      最近更新 更多