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
Apache 当特定url至少包含一个大写字母时,如何重定向到小写_Apache_.htaccess - Fatal编程技术网

Apache 当特定url至少包含一个大写字母时,如何重定向到小写

Apache 当特定url至少包含一个大写字母时,如何重定向到小写,apache,.htaccess,Apache,.htaccess,我需要将所有可能的小写/大写url组合重定向为小写,但仅针对一个特定url示例url 样本: /eXample url=>/eXample url /示例Url=>/示例Url /示例URL=>/示例URL RewriteRule^示例url(.*)$/示例url$1[NC,R=301,L]导致重定向循环 谢谢你的帮助 您可以使用前瞻来确保至少有一个大写字母带有(?i)标志,以使其在前瞻后忽略大小写: RewriteEngine On RewriteRule ^(?=[^A-Z]*[A-Z]

我需要将所有可能的小写/大写url组合重定向为小写,但仅针对一个特定url
示例url

样本:

/eXample url=>/eXample url
/示例Url=>/示例Url
/示例URL=>/示例URL

RewriteRule^示例url(.*)$/示例url$1[NC,R=301,L]
导致重定向循环


谢谢你的帮助

您可以使用前瞻来确保至少有一个大写字母带有
(?i)
标志,以使其在前瞻后忽略大小写:

RewriteEngine On

RewriteRule ^(?=[^A-Z]*[A-Z])(?i)example-url(/.*)?$ /example-url$1 [R=302,L]
  • (?=[^A-Z]*[A-Z])
    是一个正向前瞻性,以确保至少有一个大写字母
  • (?i)
    用于使模式的其余部分忽略大小写
没有前瞻性的替代方案:

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^example-url(/.*)?$ /example-url$1 [R=302,L,NC]

完美的这就是我要找的,但是没有NC标志。谢谢