The default link form of the wordpress page adopts the "plain" method (for example: http://domain name/?p=123)
Such a dynamic URL The link is not convenient for search engines to include. For this reason, we need to set it to several other common fixed link forms, such as http://www.sufaith.com and choose [custom structure].
The setting method is as follows:
Enter the homepage of the WordPress backend system, click the menu [Settings]-[Permanent Link]
Select [Common Settings] 】【Customized structure】, you can choose a single tag or a combination of multiple tags, and you can customize the splicing string. This site uses /%post_id%.html. After filling in, click [Save changes]. It takes effect.
After saving the changes, although the link to the article or page becomes a fixed link, when accessing the page, it becomes a download operation and the page cannot be accessed normally. URL address, then you need to configure nginx’s pseudo-static (URL Rewrite) rules.
The following is the configuration of nginx, which needs to be modified to your own domain name and root path.
server { listen 80; server_name www.example.com; root /usr/local/www/wordpress; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?$args; } rewrite /wp-admin$ $scheme://$host$uri/ permanent; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
After modifying the configuration After that, restart nginx to take effect and restore normal access.
systemctl restart nginx.service