• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

How to Configure Nginx for WordPress Permalinks

Written by Rahul, Updated on April 21, 2020

WordPress is the popular content management system (CMS) written in PHP. MySQL is the backend database server for WordPress. It maintains its URLs with permalink is the full URL of any post, page or any other content on the website. Apache web server uses .htaccess to manage permalinks for WordPress. Nginx doesn’t follow .htaccess, So we need to make changes in Nginx configuration to follow permalinks by Nginx web server.

The default WordPress permalinks are not SEO friendly. Which is not good for the SEO for your application. You need to change permalinks settings to make URLs SEO friendly. To change permalinks, Login to admin panel >> Settings >> Permalinks option.

Default Permalinks:

  • https://tecadmin.net/?p=101

SEO Friendly Permalinks:

  • https://tecadmin.net/post-name
  • https://tecadmin.net/category/post-name
  • https://tecadmin.net/2020/01/22/post-name

Wordpress permalinks setting

Setup Nginx for WordPress Permalinks

For example, your blog is running with the main domain. Edit the Nginx configuration file and add the following line under the location section.

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

If you are running your blog under sub directory URL like /blog, use location a /blog block to your configuration file

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

Save your file and reload the Nginx service.

system restart nginx.service

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

Leave a Reply Cancel reply

Popular Posts

  • How To Install Python 3.9 on Ubuntu 20.04 5
  • How To Install Python 3.9 on Ubuntu 18.04 0
  • How to Use AppImage on Linux (Beginner Guide) 2
  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy