M
M
Michael2019-12-28 22:05:24
Nginx
Michael, 2019-12-28 22:05:24

How to properly redirect pages in NGINX? Does adding ?yclid= break links?

There are several outdated pages on the site that are advertised from Yandex Direct.
Since during the existence of the site there have already been several such pages (different webmasters, old pages receive traffic, etc.), but they cannot be deleted for historical reasons. Moreover, at one time they gave a robust traffic.
What was done the other day - a page was created and a redirect was made to it from all the old ones - everything works, now I looked at the logs and metrics and it is clear that the server incorrectly issues (or rather gives 404) the response is registered ?yclid=364357587646
The situation is this
If you go to https:// sitename.ru/pagename - everything is fine, the redirect from all pages to this one works correctly (the server gives the code 301 and the new address, I checked curl -I in the console, everything is clear)
But if you go to the same page but with the direct ID https://sitename.ru/pagename?yclid=364357587646 the site gives an error 404
Server config code #rewrite ^/olpage$ /newpage permanent;

How to win? Advertising spanks - people see 404, not in order ... So far, the redirect has been rolled back, but you need to do it wisely and forget it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2019-12-29
@happy-cat

Issue resolved

rewrite ^/pageold?$ /pagenew permanent;
rewrite ^/pageold/?$ /pagenew permanent;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question