【问题标题】:htaccess 301 Redirect issuehtaccess 301 重定向问题
【发布时间】:2011-11-01 04:17:14
【问题描述】:

我的网站有以下 URL 结构:

http://domain.com/slug/1/test-test.html
http://domain.com/slug/2/test-test.html

我想把它改成

http://domain.com/new-1-test-test.html
http://domain.com/new-2-test-test.html

我已经试过了

RewriteRule ^slug$ /new- [R=301,L]
RewriteRule ^/?my\slug /new [R=301,L]

但它不起作用.. 有人知道如何使用 htaccess 重定向吗?

谢谢

【问题讨论】:

    标签: .htaccess redirect slug


    【解决方案1】:

    试试这个 - RewriteRule ^slug/([0-9]+)/(.*)$ /new-$1-$2 [R=301, L]

    【讨论】:

      【解决方案2】:
      RewriteEngine On
      RewriteRule ^slug/([0-9])/(.*)$ /new-$1-$2 [R-301,L]
      

      【讨论】:

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