wordpress页面的默认连接形式采用”朴素”方式 (例如: http://域名/?p=123)
php
这样的动态URL连接不便于搜索引擎的收录, 为此, 咱们需设置为其余几种常见的固定连接形式, 本网站 www.sufaith.com 选择的是 【 自定义结构 】.html
设置方式以下:nginx
进入wordpress后台系统首页, 点击菜单 【设置】- 【固定连接】bash
选择【经常使用设置】 下的 【自定义结构】 , 可选择单个标签或多个标签组合, 可自定义拼接字符串, 本站点使用的是 /%post_id%.html, 填写完毕后, 点击 【保存更改】便可生效.
wordpress
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;
}
}复制代码
修改完配置后, 重启nginx便可生效, 恢复正常访问.post
systemctl restart nginx.service 复制代码