Report this

What is the reason for this report?

301 redirect nginx

Posted on May 12, 2014

Hello! I need 301 redirect from site.com/category/something to site.com/something/



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!

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.
server {
listen 80;
server_name www.bandatnendongnai.vn bandatnendongnai.vn 202.182.98.49;
rewrite ^(.*) https://www.bandatnendongnai.vn$1 permanent;
rewrite ^/du-an(.*) https://$server_name/category/du-an/$1 permanent;
}
server {
    listen       443 ssl http2;
    server_name  bandatnendongnai.vn;
    return       301 https://www.bandatnendongnai.vn$request_uri;
	rewrite ^/du-an(.*) https://$server_name/category/du-an/$1 permanent;
ssl_certificate /etc/nginx/paidssl/www.bandatnendongnai.vn/www.bandatnendongnai.vn.crt;
ssl_certificate_key /etc/nginx/paidssl/www.bandatnendongnai.vn/www.bandatnendongnai.vn.key;

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

Thanks for answer but i have 404

Sry, works great, thanks!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.