Nginx WordPress Permalink Fix

Nginx WordPress permalink. Three words that made me lose a bit of hair.

If you are looking for the quick technical solution to your Nginx WordPress permalink problem, change your Nginx config to:

location / {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
}

By default, Nginx serves the webpage or the directory from the url path. Take http://ethanbytes.com/nginx-wordpress-permalink-fix/ for example. Nginx will treat “nginx-wordpress-permalink-fix” as a file. Unless you have “nginx-wordpress-permalink-fix.php” file in your root directory, it will serve the 404 page not found page. This rewrite rule tells Nginx to pass the query string to index.php instead of treating it as a file in the index directory.

This article will now move on to introducing my thoughts in choosing Nginx, WordPress and the advantages of using permalink.

Why Nginx WordPress Permalink

I started the Ethanbytes.com project with the goal of it being a high performance, SEO friendly blogging platform.

I have ever only used Apache as a hosting server in my whole web development career. This was until Nginx (pronounced engine-X) came into the picture.

The Emergence of Nginx

There is a more extensive article about the humble beginnings of Nginx. The article points out Nginx’s emerging popularity among websites with heavy traffic. In short, Nginx seems to be getting the upper hand against Apache in the battle for web server supremacy. A faster website contributes to a better user experience and a better SEO score.

WordPress = Blog

Name me the first word that you can relate to the word BLOG. The key advantage of using WordPress is that it really is easy for article writing and content creation. WordPress is powered by an array of plugins. This means that I can focus on content writing instead of writing codes.

Permalinks

I am of the believe that permalink DO contribute to SEO ranking. Permalink is the full url displayed on the browser address bar that is tied to your specific content. For example, this article has the permalink http://ethanbytes.com/nginx-wordpress-permalink-fix/. On the contrary, this article could easily be http://ethanbytes.com/2016/12/9. Or it can be a random id after the domain name.

When you search for certain keywords in Google, your permalink will be highlighted. Hence put a little bit of thought and use the keywords in your article as your permalink.

Conclusion

Keep in mind of the initial configuration of Nginx. If you want to use permalink, you will need to rewrite the configuration rule. Hopefully this simple fix will save you some hair.

One thought on “Nginx WordPress Permalink Fix”

Leave a Reply to Jual Selempang Wisuda Cancel reply

Your email address will not be published. Required fields are marked *