【问题标题】:Redirect (301) single page without mod_alias?在没有 mod_alias 的情况下重定向(301)单页?
【发布时间】:2012-07-12 06:02:03
【问题描述】:

如何在没有 mod_alias 的 .htaccess 中为单个页面创建永久重定向 (301)?

f.e.

http://www.example.com/oldpage --> http://www.elpmaxe.com/newpage

【问题讨论】:

    标签: apache .htaccess mod-rewrite redirect mod-alias


    【解决方案1】:

    我的队友给了我很好的答案:

    RewriteCond %{http_host} www\.example\.com$ [nc]
    RewriteCond %{request_uri} ^/oldpage(/)?$ [nc]
    RewriteRule ^(.*)$ http://www.elpmaxe.com/newpage [r=301,L,NC,NS,QSA]
    

    【讨论】:

      【解决方案2】:

      使用 mod_rewrite 和下面的 .htaccess

      RewriteEngine on
      RewriteRule ^oldpage/(.*)$ newpage/$1 [R=301]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-05-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-01-02
        • 2015-10-20
        • 2011-06-18
        • 1970-01-01
        相关资源
        最近更新 更多