【问题标题】:Mod rewrite and redirect solutionMod重写和重定向解决方案
【发布时间】:2015-04-10 12:14:06
【问题描述】:

我们有数百个位置,并在wordpress(位置在某些状态...)中为每个位置建立一个单独的页面:ourdomian.com/location-in-some-state/ 效果很好。

SEO 人员想要另一个具有不同 seo 设计的页面:ourdomain.com/newpage/location-in-some-state 我们不想更改模板,因为我们仍然使用旧模板。 我要新建一个页面,用slug拉取数据:

 'categories'=> 'location-in-some-state',

所以我需要重定向ourdomain.com/location-in-some-state to ourdomain.com/newpage/

类似这样,但我认为这里有一个无限循环

  RewriteRule ^newpage/(.*)$ /newpage/ [R=301,NC,L]

最后,不知何故,我的蛞蝓需要“某个状态的位置”。可以将其移动到查询字符串或在 url 中可见但现在重写吗?如果它可以重定向到/newpage/ 并用/newpage/location-in-some-state 重写(仅可视化),也许我可以将它从 URI 中拉出来,或者可以将 URI 发送到查询字符串??????

【问题讨论】:

    标签: php wordpress .htaccess mod-rewrite redirect


    【解决方案1】:

    你的意思是这样的:

    RewriteCond $1 !^newpage/
    RewriteRule ^(.*)$ /newpage/$1 [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 2016-06-02
      • 2013-06-16
      • 2012-08-24
      • 1970-01-01
      • 2011-04-18
      • 1970-01-01
      • 1970-01-01
      • 2010-12-31
      • 1970-01-01
      相关资源
      最近更新 更多