【问题标题】:redirecting with .htaccess from several URL with language使用 .htaccess 从多个带有语言的 URL 重定向
【发布时间】:2015-11-16 08:55:21
【问题描述】:

我已经搜索和测试了几天...但我无法使用 .htaccess 进行所需的重定向

我需要重定向所有以page-about.html结尾的网址

该网站有 2 种语言,我想重定向:
/es/*/page-about.html => /es/content/about
/en/*/page-about.html => /en/content/about

我该怎么做?

谢谢。

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    试试:

     RedirectMatch ^/(en|es)/+page-([^.]+)\.html$ /$1/content/$2
    

    这将重定向:

    http://example.com/en//page-about.html
    

    http://example.com/en/content/about
    

    【讨论】:

    • 这不是我所需要的,但它帮助我制定正确的规则:RedirectMatch ^/(en|es)/(.*)/+page-about\.html$ /$1 /内容/关于
    • 我会做出类似的回答,直到我发现问题格式存在可疑之处。 * 完全丢失了。
    • 是的最终,我不知道为什么星号来自原始问题:S
    猜你喜欢
    • 2012-08-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多