Answer the question
In order to leave comments, you need to log in
How to properly redirect nginx?
Hello. Tell me, nginx gurus.
How to make a 301 redirect? It is necessary for SEO. There are pages like goods/2, for each of them you need to register a redirect, for example, to /shlang-inekcionnyj.
Tried this option:
rewrite ^(/goods/2)(.*)$ /shlang-inekcionnyj/$2 permanent;
server_name site.ru/category/articleID-articleName/;
rewrite ^ site.ru/category/articleID/$request_uri? permanent; #301 redirect
Answer the question
In order to leave comments, you need to log in
And you are not tormented for each product to prescribe url? there must be a correspondence between the id number of the product and its CNC. Perhaps it's easier to write a few lines of code on the server side in the site engine? If you go to goods/2 - get the product with id2, look at its url and make the 301 redirect code. For example in PHP:
header( 'Location: http://your.site/goods/' . $goodUrl, TRUE, 301 );
It turns out that everything is easier than ever.
like this: rewrite ^/old address/& http://new address;
thanks to all
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question