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