301 redirect nginx

May 12, 2014 26.4k views
Hello! I need 301 redirect from site.com/category/something to site.com/something/
1 comment
3 Answers
You can use a rewrite rule, like so:

rewrite ^/category/something/(.*)$ http://site.com/something/$1 redirect;

And remember to restart nginx:

service nginx restart

Check out this article:

by Justin Ellingwood
HTTP redirects are used to redirect web site visitors to new locations when they request content. These are useful for a variety of reasons, whether permanent or temporary. This guide will demonstrate how to redirect visitors using Apache and Nginx.
Thanks for answer but i have 404
Have another answer? Share your knowledge.