301 redirect nginx

Hello! I need 301 redirect from to

Show comments

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

You can use a rewrite rule, like so: <br> <br><pre> <br>rewrite ^/category/something/(.*)$$1 redirect; <br></pre> <br> <br>And remember to restart nginx: <br> <br><pre> <br>service nginx restart <br></pre> <br> <br>Check out this article: <br> <br>

server {
listen 80;
rewrite ^(.*)$1 permanent;
rewrite ^/du-an(.*) https://$server_name/category/du-an/$1 permanent;
server {
    listen       443 ssl http2;
    return       301$request_uri;
	rewrite ^/du-an(.*) https://$server_name/category/du-an/$1 permanent;
ssl_certificate /etc/nginx/paidssl/;
ssl_certificate_key /etc/nginx/paidssl/;

and then service nginx restart

Check nginx nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

Please help me. Thank you so much

Hi admin I want change old a URL New URL I using nginx. Thank you so much