【问题标题】:How to change locale from get parameter to path in url by htaccess如何通过htaccess将区域设置从get参数更改为url中的路径
【发布时间】:2015-09-19 22:05:55
【问题描述】:

我想替换 .htaccess 中的 url(301 重定向)
来自www.domain.com/page.html?locale=xx
www.domain.com/xx/page.html
我找不到正确的文档来修复它。

【问题讨论】:

标签: .htaccess url query-string url-redirection


【解决方案1】:

您可以在 DOCUMENT_ROOT/.htaccess 文件中使用此代码来剥离查询字符串:

RewriteEngine On

RewriteCond %{QUERY_STRING} ^locale=.+ [NC]
RewriteRule ^page\.html$ $0? [L,NC,R=302]

【讨论】:

    猜你喜欢
    • 2014-02-28
    • 1970-01-01
    • 2011-09-24
    • 1970-01-01
    • 1970-01-01
    • 2019-12-29
    • 1970-01-01
    • 1970-01-01
    • 2015-01-10
    相关资源
    最近更新 更多