Enabling ‘pretty’ permalinks in Nginx / WordPress

This wordpress article enumerates some of the differences between an Apache and a Nginx based setup.

I ran into this issue, while trying to change the URL format of the blog posts / pages on the website. Essentially, I could not. I was on the fence about enabling ‘pretty’ URLS and was inclined to think that a ‘short and sweet’ page number based URL. A discussion on #ossasepia led me to change my mind, i.e I felt it made sense that the URL was also meant to be read by human beings. Personally, I do ‘read’ or process URL’s, and believe that on many occassions, one can atleast get a ‘sense’ of if a link is completely suitable by looking at the URL. So, it was concluded that the URL is not just for the machine.

It appears from the article above that Nginx does not have a ‘directory’ level configuration, and any configuration has to be done at the server level.

I’m yet to understand how Nginx actually works. For now, I found a solution in this post, which essentially instructed adding /index.php?$args to the location segment in /etc/nginx/site-enabled/s.ragavan.co.conf.

i.e this argument instructs Nginx to look for the specified link in the location /index/+arguments. These arguments would then be the month/data/post-name or however the permalink format is setup.

Leave a Reply

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