Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess将大写重写为小写_.htaccess_Url Rewriting - Fatal编程技术网

.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不区分大小写,这是首选选项