mod_rewrite RewriteCond - is NC flag necessary for just domain part? And some more

南楼画角 提交于 2019-11-30 01:23:05

Having [NC] is definitely not mandatory but it is recommended to have it for matching domains. Modern browsers might be converting domain names to lowercase but what about old browsers and command line utils like wget, curl etc, so you should not always rely on clients sending you lowercase domain name and keep [NC].

About your 2nd question . matches any character therefore it is able to match www.domain.com but it will also match www-domain-com text which you don't want to match. So it is better to have www\.domain\.com

NC = nocase means regardless of the case of the incoming referrer traffic match with the given pattern.

See Apache [NC|nocase] flag

sauerburger

I don't know the [NC] for sure, but I suppose that in some unlikely event the the ENV var. could contain upper case chars.

A dot in a regular expression means one character, any character. SO the first condition would also match if the string is http://www_domain-it or http://wwwadomain1it

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!