Answer the question
In order to leave comments, you need to log in
How to properly set up a redirect with $args?
Please help me figure out how to set up a redirect, I've already broken my head and tried a thousand combinations.
What is available: There are pagination pages of the site.ru/?q=&p=331 format
What needs to be done: Redirect to site.ru/page/331 format pages
Or just give the 404 page
Answer the question
In order to leave comments, you need to log in
location = / {
if ($arg_p) {
rewrite / /page/$arg_p? redirect;
}
}
location / {
if ($query_string ~ "(^|&)q\=($|&)"){
if ($query_string ~ "(^|&)p\=([0-9]({1,})($|&)"){
rewrite ^/$ /page/$2? redirect;
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question