【问题标题】:Percentage (%) in the joomla blog post url breaking sitejoomla 博客文章 url 中断站点中的百分比 (%)
【发布时间】:2012-10-19 10:08:10
【问题描述】:

任何人都知道如何重定向

域/博客/208-%-top.html

收件人:

域/博客/208-top.html

在 Joomla 中?

以下都不起作用:

RewriteRule ^blog/208-%-top.html$ 208-top.html [R=301,L]
RewriteRule ^blog/208-\%-top.html$ 208-top.html [R=301,L]
RewriteRule ^blog/208-.*-top.html$ 208-top.html [R=301,L]

它适用于:url 有 %20 或 %25 并且在 htaccess 中有以下

RewriteRule ^blog/208-%20-top.html$ 208-top.html [R=301,L]
RewriteRule ^blog/208-%25-top.html$ 208-top.html [R=301,L]

但问题是博客文章只有 %。有什么办法可以解决这个问题吗?

【问题讨论】:

    标签: .htaccess redirect joomla


    【解决方案1】:

    这个网址:

    domain.com/blog/208-%-top.html
    

    确实是一个无效的 URL,并且会在您的 Apache 日志中导致 HTTP 400(错误请求)错误。

    您也注意到这两个 URL 中的任何一个都是有效的:

    domain.com/blog/208-%20-top.html
    

    或

    domain.com/blog/208-%25-top.html
    

    并且它们都可以很好地使用这个重写规则:

    RewriteRule ^blog/208-\%-top\.html$ blog/208-top.html [R=301,L,NC]
    

    【讨论】:

      【解决方案2】:

      您的问题可能是因为 apache 没有将您的重写目标正确识别为 URL 路径,您需要包含完整路径来解决该问题。

      RewriteRule ^blog/208-\%-top.html$ /blog/208-top.html [R=301,L]
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-04-16
        • 1970-01-01
        • 2014-05-05
        相关资源
        最近更新 更多