【问题标题】:301 Redirect with Space After .htm.htm 后带有空格的 301 重定向
【发布时间】:2013-10-21 08:07:59
【问题描述】:

我正在尝试在我的 .htaccess 中执行从“http://example.com/article.htmk”到“http://example.com/article.htm”的 301 重定向。我试过了,

Redirect 301 "http//example.com/article.html k" http://example.com/article.htm

如上,并用 %20 和 [\s] 代替 k 的空格。这些似乎都不起作用。我在想问题是因为空间在 .htm 之后而不是在它之前。关于如何解决这个问题或问题可能是什么的任何想法?谢谢。

【问题讨论】:

  • RTFM: “旧的 URL 路径是以斜杠开头的区分大小写(% 解码)的路径。”

标签: .htaccess redirect


【解决方案1】:

你需要使用Redirect作为

Redirect 301 /article.html\ k http://example.com/article.htm

或使用RedirectMatch(指定正则表达式)

RedirectMatch 301 /article\.html\sk http://example.com/article.htm

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-12
    • 1970-01-01
    • 2013-07-02
    • 2010-11-07
    • 1970-01-01
    • 1970-01-01
    • 2011-11-06
    • 1970-01-01
    相关资源
    最近更新 更多