【问题标题】:Removing "/" and "-" by 301 redirect via htaccess通过 htaccess 通过 301 重定向删除“/”和“-”
【发布时间】:2016-06-28 17:51:56
【问题描述】:

301 重定向:

example.com/AnythingHere/-/AnythingHere.html

到:

example.com/AnythingHere/AnythingHere.html

注意:AnythingHere 表示任何数字/字母/破折号/下划线。

试过了,但没用:

RewriteRule (.*)/(.*)-(.*)\.html$  (.*)/-/(.*)-(.*)\.html$

【问题讨论】:

    标签: apache .htaccess url-rewriting http-status-code-301


    【解决方案1】:

    您可以使用 RedirectMatch :

    RedirectMatch 302 ^/(.+)/-/(.+)\.html$ http://example.com/$1/$2.html
    

    【讨论】:

    • 感谢您的回答。它重定向但不重定向到 example.com/AnythingHere/AnythingHere.html 它有奇怪的重定向到类似的东西:example.com/AnythingHere.html?Location=-&countrySelect=search.php&Select=Account&submit =1
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-23
    • 2013-06-21
    • 2014-09-21
    • 2017-03-04
    • 2013-09-12
    相关资源
    最近更新 更多