D
D
D99100992017-05-25 16:56:52
Nginx
D9910099, 2017-05-25 16:56:52

How to compose redirect nginx?

There is a website with a forum on it.
the link to the topic looks like this:
site.ru/viewtopic.php?t=74384
but in the Yandex search there are many links to the pages of the site of this type:
site.ru/?t=74384
Tell me how to make a 301 redirect so that when you request the address site. ru/?t=74384 was issued site.ru/viewtopic.php?t=74384
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-05-25
@D9910099

location = / {
    if ($arg_t != '') {
      return 301 "/viewtopic.php?t=$arg_t";
    }
  }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question