How To Change permalinks WordPress Nginx?
- arjun5792
- Sep 27, 2022
- 2 min read
With the assistance of Skynats' Server Management team, let's take a closer look at how to Change permalinks WordPress Nginx.
Overview: WordPress Permalinks Nginx
WordPress is a well-known content management system, or CMS, written in PHP/HTML. MySQL serves as WordPress' backend database server. A permalink, which is the complete URL of each post, page, and other piece of content on the website, is used to maintain its URLs.
The Apache web server and.htaccess is used to manage permalinks for WordPress. Nginx does not follow.htaccess, so we must modify the Nginx configuration for the Nginx web server to follow permalinks.
Simply put, a permalink is a web address used to link your blog posts. The name "permalink" refers to the idea that each blog post's or CMS website's URL should be static and never change. Your blog posts and archives can be given a unique URL structure thanks to WordPress. Three fundamental WordPress permalink types are demonstrated below:
Ugly: https://www.skynats.com/faq/?p=222
Pretty using mod_rewrite: https://www.skynats.com/faq/bash-for-loop/
Almost pretty using PHP PATHINFO: https://www.skynats.com/faq/index.php/bash-for-loop/
The default WordPress permalinks are not optimized for search engines, which is bad for your SEO strategy. To make URLs SEO-friendly, permalink settings must be changed. You must log in to the admin panel and select the Permalinks option under Settings.
Configure WordPress Permalinks with Nginx
For instance, if your blog is active on the primary domain. Add the following code line to the location section of your Nginx configuration file:
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
Use the location as /blog block in your configuration file as follows if you are running your blog under any subdirectory URLs, such as /blog internal link:
location /blog {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
Afterward, save and reload the Nginx service:
system restart nginx.service
Conclusion
As a result of reading this article on how to change the permalinks on a WordPress blog using Nginx, you now know how to create the URL for a WordPress blog. For your blog posts and archives, WordPress also can create a custom URL structure.
Comments