Hello! I need 301 redirect from http://myweb.com/watch/fadfadf1 to http://myweb.com/watch-1/fadfadf1

Please help me. Thank you very much

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.

2 answers

Add the following to your server block in your site definition in /etc/nginx/sites-enabled

rewrite ^/watch/fadfadf1$ http://www.newdomain.com/watch-1/fadfadf1 redirect;

Then restart nginx with:

sudo service nginx restart
Submit an Answer