What does L, R, NC mean in HTACCESS?

Asked

Viewed 6,362 times

8

I don’t quite understand the way the flag works L.

The 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 objectives were:

The first:

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

The second (due to poor structure of the developed system):

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

The second was not working. However, when adding [NC,L], everything worked as expected.

Thus:

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

What the L did in my rewrite rule?

Which means the other flags, like R and NC?

1 answer

15


Follows the documentation of the Apache on the 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 commands the browser to redirect. You need to put the full URL.

The [NC] is no-case, only causes comparisons to be made in mode case-insensitive, i.e., without differentiating between upper and lower case.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.