【问题标题】:301 redirect subcategory to specific page and redirect rest of site as well301 将子类别重定向到特定页面并重定向站点的其余部分
【发布时间】:2018-01-12 11:09:36
【问题描述】:

我正在尝试将网站上的子类别重定向到新域上的特定页面,并将其他所有内容从旧域重定向到新域。

我设置的网站重定向是这样的:

RewriteEngine on 
RewriteRule (.*) http://www.new-site.co.uk/$1 [R=301,L]

但我还想将旧网站上的子类别重定向到新网站上的特定页面。

例如,我想将https://www.old-site,co.uk/category/subcategory(末尾带有和不带有斜杠)重定向到https://www.new-site.co.uk/page.htm

任何帮助将不胜感激。谢谢!!

【问题讨论】:

    标签: .htaccess redirect http-status-code-301


    【解决方案1】:

    你可以用这个

    RewriteEngine on
    
    #redirect /category to a specific page on external domain
    RewriteRule ^category/?$ http://www.new-domain.com/page.htm [L,R]
    #everything else to newdomain
    RewriteRule (.*) http://www.new-site.co.uk/$1 [R=301,L]
    

    在测试之前清除浏览器缓存。

    【讨论】:

      猜你喜欢
      • 2017-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-08
      • 1970-01-01
      相关资源
      最近更新 更多