How to make a Rewrite with nginx?

0 like 0 dislike
65 views
Hello, there is a rewrite:

rewrite ^/(.+?)/(.+?)$ /cp.php?name=$1&nick=$2 last;
It comes to the name and nickname of the user. But it so happened that nick can begin with a dot.
URL: test.ru/1/.Vasya. nginx gives a 403 Forbidden error.
URL: test.ru/1/Vasya. open.

Is it possible to change rewrite, forcing nginx to open links to begin with . ?
asked by | 65 views

2 Answers

0 like 0 dislike
The problem was in the last rule /\\. removed it and it worked.
answered by
0 like 0 dislike
Dot is a special character in regular expressions if you need to use the point as a point that required "seascaping" tochku \\.

Something like that
rewrite ^/(.+?)/(\\..+?)$ /cp.php?name=$1&nick=$2 last;
answered by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
24,509 questions
45,932 answers
0 comments
345 users