Nginx 301 redirect examples

Here's an example of how to do a 301 Redirect with Nginx:

rewrite /blog/Content/2/8/581 /blog/post/java/dos-batch-files-compile-run-java-program-create-jar-file permanent;

As you can see, Nginx uses the keyword permanent instead of 301.

I just did a few hundred of these on this alvinalexander.com website. I put them in a separate redirects.conf file, and included that file into my main nginx.conf file like this:

include redirects.conf;

I put that include line in the server section of my main nginx.conf file.