Home > CMS Tutorial > WordPress > body text

How to set pseudo-static links in WordPress

藏色散人
Release: 2021-07-12 14:52:06
forward
2906 people have browsed it

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]

How to set pseudo-static links in WordPress

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.

How to set pseudo-static links in WordPress

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;
    }
}
Copy after login

After modifying the configuration After that, restart nginx to take effect and restore normal access.

systemctl restart nginx.service
Copy after login

For more WordPress technical articles, please visit the WordPress tutorial column!

The above is the detailed content of How to set pseudo-static links in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!