I have seen many times in htaccess
these type of rules :
RewriteCond %{HTTP_REFERER} !^http://www.domain.it$ [NC]
or
RewriteCond %{HTTP_HOST} !^www\.domain\.it$ [NC]
Why is the NC
flag necessary, when checking only the domain part?
I noticed browsers always converts uppercases in domain names into lower cases, so I don't see what the [NC]
flag is usueful for in this case.
I mean if we check the remaining part of the url I understand the need for [NC]
flag cause on Unix systems www.domain.com/index.html
is different file than www.domain.com/INDEX.HTML
but I don't understand the need of NC
flag when we check only the domain part in the RewriteRule.
Since you took the time to read the above, let me ask also one minor question not directly related to NC
flag, but still related to RewriteCond
Both RewriteCond
shown above work well, I thought only the one with slash before dots would work (!^www\.domain\.it$
) because the dot without a slash should mean 'any char' in regexp whilest the \.
means the dot char, but surpraisingly also the other one works well, do you know why?