Please enable / Bitte aktiviere JavaScript!
Veuillez activer / Por favor activa el Javascript![ ? ]
How to make a Rewrite with nginx? - bug-code.com Q&A

How to make a Rewrite with nginx?

0 like 0 dislike
70 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 | 70 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
Welcome to Bug-code Q&A, where you can ask questions and receive answers from other members of the community.

24.8k questions

46.2k answers

0 comments

12.3k users

24,788 questions
46,220 answers
0 comments
12,337 users