Answer the question
In order to leave comments, you need to log in
How to make redirects to nginx at the end of the url?
Greetings!
There is a pack of urls (more than 200 pieces with changing numbers at the end) with parameters, example:
site.ru/index.php?route=product/category&path=90_128 You
need to make a 301 redirect to another site (gluing, target pages have different addresses ).
Because of the question mark, the conditions do not pass.
I wanted to do it through location, at the end of the url (path=90_128) - that doesn't work either.
How to make conditions for location for such url?
Answer the question
In order to leave comments, you need to log in
And it won't work because it location
uses the normalized URI and no arguments. With rewrite
a similar situation. A simple solution to the problem:
location /index.php {
if ($arg_path ~ "^[0-9]{2}_[0-9]{3}$") {
return 301 https://example.com/;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question