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 複製代碼