【问题标题】:Redirect old domain to new domain using .htaccess使用 .htaccess 将旧域重定向到新域
【发布时间】:2020-06-15 08:20:21
【问题描述】:

它真的很基本,但我不能让它工作。如何将旧域重定向到新域,并将某些页面从旧域重定向到新域的新 url?

重定向 1 http://www.oldsite.com https://newsite.com/

重定向 2 http://www.oldsite.com/about/ https://newsite.com/this/

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^http://www.shion-kaikan.com$ [NC]
RewriteRule ^(.*)$ https://shion.com/ [R=301,L]

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    您无法匹配 %{HTTP_HOST} 中的 URL 方案或路径。您只能匹配您的域名,即 . example.com 或 www.example.com 。

    以下应该有效。

    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^www.shion-kaikan.com$ [NC]
    RewriteRule ^(.*)$ https://shion.com/ [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 2016-06-24
      • 1970-01-01
      • 2012-04-03
      • 2013-09-23
      • 2016-02-18
      • 2015-07-17
      • 2014-05-25
      • 2013-02-20
      • 2021-07-24
      相关资源
      最近更新 更多