Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»Web Servers»Nginx»How to Configure Nginx for WordPress Permalinks

    How to Configure Nginx for WordPress Permalinks

    RahulBy RahulApril 2, 20202 Mins ReadUpdated: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
    
    nginx
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Get IP Address of A Docker Container
    Next Article How to Setup Let’s Encrypt SSL with Apache on Fedora

    Related Posts

    How To Install Linux, Nginx, MySQL, & PHP (LEMP Stack) on Ubuntu 22.04

    Updated:April 7, 20227 Mins Read

    How to Increase Request Timeout in NGINX

    Updated:January 13, 20222 Mins Read

    How to Install Nginx, MySQL & PHP (LEMP) on Ubuntu 20.04

    5 Mins Read

    How To Install Nginx with PHP-FPM on Ubuntu 20.04

    Updated:December 3, 20203 Mins Read

    How to Install Nginx on Ubuntu 20.04

    3 Mins Read

    How to Install Nginx with PHP-FPM on CentOS 8

    Updated:March 7, 20204 Mins Read

    2 Comments

    1. Madusanka on January 27, 2022 6:36 am

      This does not work. Goes to 404 when used “Post Name” Permalink

      Reply
    2. Eduardo Cere on January 31, 2021 1:20 am

      I just can’t make this work! I get “File not found” everytime I click a link on the home page.

      Reply

    Leave A Reply Cancel Reply

    Recent Posts
    • How to run “npm start” through docker
    • Filesystem Hierarchy Structure (FHS) in Linux
    • How to accept user input in Python
    • What is difference between var, let and const in JavaScript?
    • What is CPU? – Definition, Types and Parts
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.