.htaccess htaccess将大写重写为小写
我需要在重定向所有大写(或驼峰或任何情况下)类别链接到小写类别链接的帮助 例如:.htaccess htaccess将大写重写为小写,.htaccess,url-rewriting,.htaccess,Url Rewriting,我需要在重定向所有大写(或驼峰或任何情况下)类别链接到小写类别链接的帮助 例如: hostname/category/Case (should be redirected to) - hostname/category/case hostname/category/CASE (should be redirected to) - hostname/category/case 您可以始终使用内部RewriteMap功能tolower,如文档中所述: RewriteMap lc int:tolow
hostname/category/Case (should be redirected to) - hostname/category/case
hostname/category/CASE (should be redirected to) - hostname/category/case
您可以始终使用内部
RewriteMap
功能tolower
,如文档中所述:
RewriteMap lc int:tolower
RewriteRule (.*?[A-Z]+.*) ${lc:$1} [R]
注意,我没有尝试上面的方法,我只是查看了mod_重写文档。查看该规则,您可能需要将[N]
放入其中,以便为CamelCase重新运行该规则:
RewriteMap lc int:tolower
RewriteRule (.*?[A-Z]+.*) ${lc:$1} [N]
但是,您也可以检查服务器是否有,如果希望URI不区分大小写,这是首选选项