3
I have this regex:
RewriteRule ^www\/login\/?$ login/ [L,NC,R]
What does she do?
3
I have this regex:
RewriteRule ^www\/login\/?$ login/ [L,NC,R]
What does she do?
7
This is a rewrite rule that is saying that the URL started with www/login preceded by / (bar) or not, redirect to login/. As flags [L,NC,R] means:
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 case-insensitive mode, i.e., without differentiating between upper and lower case.
I recommend reading the Apache documentation here and also this question related for more information: URL friendly, how to make it work with HTACCESS.
thanks, for the improvement @Uzmkartanis
Not quite "anything started" just the url you have www/login/
, www/login
, if it was "anything" it would work for url www/login/usuario/13
"The url you have" was equal to "Anything started" vague explanation, because it does not specify that it is after the domain that should contain www/login, since it comes after the operator . Anyway I tried to improve to be clearer by following the tip of friend @Guilherme.
Browser other questions tagged regex htaccess
You are not signed in. Login or sign up in order to post.
Rewrite the path
www/login/
forlogin/
.– KaduAmaral
@Uzmkartanis duplicate is forcing the bar, but it sure is a great Related.
– KaduAmaral
The flags are very well explained there. I’m just trying to help direct to a single location. But yes, as related is good @Kaduamaral
– UzumakiArtanis
Here is another related one: https://answall.com/questions/75963/url-amig%C3%A1vel-utilizando-htaccess
– KaduAmaral