What does L, R, NC mean in HTACCESS?

6

I did not understand the operation of the L flag very well.

Doubt arose when I was trying to use the following script:

#quando vier o "public" na url, reescreve para folder/public
RewriteRule ^public/(.*)$ folder/public/$1 [NC]
Rewrite ^(.*)$ folder/public/$1 [NC]

The goals were:

The first one:

mysite.com rewrite to mysite.com/folder/public .

The second (due to poor system structure developed):

mysite.com/public/img.jpg rewrite to mysite.com/folder/public/img.jpg

The second was not working. However, by adding O% with%, everything worked as expected.

So:

RewriteRule ^public/(.*)$ folder/public/$1 [NC]
Rewrite ^(.*)$ folder/public/$1 [NC]

What did [NC,L] do in my rewrite rule?

What does the other flags, such as L and R ?

    
asked by anonymous 23.03.2015 / 13:30

1 answer

11

Follow the Apache documentation about flags :

The [L] is last , that is, in a list of conditions, the conditions below the one with this flag will not be read.

The [R] is redirect , this directs the browser to do the redirect. You need to put the full URL.

The [NC] is no-case , only causes comparisons to be made in case-insensitive mode, ie case- / p>     

23.03.2015 / 14:07