Mobile app version of vmapp.org
Login or Join
Radia820

: Apache .htaccess mod_rewrite: use of [NC] I see tons of .htacces examples containing the [NC] flag (NoCase = case-insensitive) For example the famous h5bp page use the [NC] flag a lot: https://github.com/h5bp/server-config

@Radia820

Posted in: #Apache #Htaccess #ModRewrite

I see tons of .htacces examples containing the [NC] flag (NoCase = case-insensitive)

For example the famous h5bp page use the [NC] flag a lot: github.com/h5bp/server-configs-apache/blob/master/dist/.htaccess
Nearly every example put the [NC] flag at the end of the RewriteCond directive.
But the Official documentation clearly states it is used only for the RewriteRule directive.

Are 99% of the examples wrong ?
Is the official documentation wrong or incomplete ?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Radia820

1 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo487

But the Official documentation clearly states it is used only for the RewriteRule directive.


The docs don't say that it can only be used on the RewriteRule directive. The page you link to (which incidentally is specifically about the RewriteRule flags) simply states:


Use of the [NC] flag causes the RewriteRule to be matched in a case-insensitive manner.


The docs for the RewriteCond directive include a section on the flags that can be used with this directive. And these include NC, OR and NV. The NC flag is common to both directives.

If you did use an invalid flag on the RewriteCond directive you'll get a 500 Internal Server error.

However, (bit of an aside), the NC flag is used too much. People often include it by default, when it really isn't necessary (or worse, will actually cause problems).

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme