Let us take a closer look at how to Change permalinks WordPress Nginx with the help of WordPress Support Service at Bobcares.
WordPress Permalinks Nginx Overview
WordPress is a popular content management system i.e CMS written in PHP/HTML and MySQL is the backend database server for WordPress. It maintains its URLs with a permalink is the full URL of any post, page, or any other content on the website.
To manage permalinks for WordPress the Apache web server is used with .htaccess. However, Nginx doesn’t follow .htaccess so basically we need to make changes in the Nginx configuration to follow permalinks by the Nginx web server.
A permalink is simply a web address that is used to link your blog content. The URL to each blog post or CMS website should be permanent and should never change, hence the name permalink. WordPress can create a custom URL structure for your blog posts and archives. Below examples are three basic types of WordPress permalinks:
- Ugly: https://www.bobcares.com/faq/?p=222
- Pretty using mod_rewrite: https://www.bobcares.com/faq/bash-for-loop/
- Almost pretty using PHP PATHINFO: https://www.bobcares.com/faq/index.php/bash-for-loop/
The default WordPress permalinks are not SEO friendly, this not good for your SEO application. You need to change permalink settings to make URLs SEO-friendly. To change permalinks you need to log in to the admin panel >> Settings >> Permalinks option.
Setup Nginx for WordPress Permalinks
For example, If your blog is running with the main domain. Edit your Nginx configuration file and then add the below code 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 any sub directory URL like /blog internal link then further use location as /blog block to your configuration file as shown:
location /blog {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?$args;
}
Next save and reload the Nginx service:
system restart nginx.service
[Need assistance with similar queries? We are here to help]
Conclusion
To conclude from this Change permalinks WordPress Nginx article you learned how to create URL for a WordPress blog using the Nginx web server. Likewise, WordPress has the ability capacity to create a custom URL structure for your blog posts and archives
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
0 Comments