Monday, May 19, 2014

Setup permalilnk in nginx



Permalink:

Permalink is a permanent URL of each post or page. It is mostly used in WordPress CMS. It helps to identify each post/page by just seeing its URL. A good permalink not only helps the visitor to understand the page/post but also good for search engine optimization. Selecting a good permalink regarding a post is good practice. This is very useful when you are blogging. It is also a good idea to use individual permalink for every posts regarding their titles. Permalink needs .htaccess file to work perfectly. However, in NGINX, you have to do some additional tweaks so that permalink works without any possible error, specially for WordPress blog. In this tutorial, I am going to show you how to setup permalink properly for WordPress in NGINX webserver.

 

1. Login in webmin as root.
2. Go to Webmin tab > Servers> Nginx webserver
3. Click "Edit Configuration Files"
4. Scroll down until you find location ~ \.php$ block
5. Right after this block, add these three lines
if (!-e $request_filename) {
 rewrite ^.*$ /index.php last;
}
6. Tick "Test new configuration before saving?" (if not already ticked).
7. Click "Save"
8. Restart NGINX webserver. Now permalink will work perfectly.

No comments:

Post a Comment