【问题标题】:htaccess 301 redirect not working with my sitehtaccess 301 重定向不适用于我的网站
【发布时间】:2014-05-26 07:38:30
【问题描述】:

我已经通过 htaccess 重写了 URL,现在我想将该 URL 重定向到另一个 URL。

现在我想将http://www.domain.com/tag/example-page URL 重定向到http://www.domain.com/tag/example

redirect 301 /tag/example-page http://www.domain.com/tag/example

请帮助我解决这个问题。

以下是我的重写规则,我将其用于短 URL

RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

【问题讨论】:

  • RewriteRule ^/tag/(.*)$ http://www.domain.com/tag/$1 [R=301,L] 在这种情况下应该可以工作。
  • 谢谢,但还不行
  • 您是否尝试清除浏览器缓存?有时这些请求会被缓存。
  • 另外,您的 301 重定向必须放在 htaccess 文件中的重写规则之上。正如 Shashank 所提到的,还要清除缓存
  • 大家好,我尝试清洁现金但不工作这是我的网站http://goo.gl/AwdW7f

标签: .htaccess url


【解决方案1】:

将此规则作为您在根 .htaccess 中的第一条规则:

RedirectMatch 301 ^/tag/example-page/?$ /tag/example

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-17
    • 1970-01-01
    • 2017-09-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多