Wordpress固定链接伪静态

601 阅读1分钟

wordpress页面的默认链接形式采用”朴素”方式 (例如: http://域名/?p=123)

这样的动态URL链接不便于搜索引擎的收录, 为此, 我们需设置为其他几种常见的固定链接形式, 本网站 www.sufaith.com 选择的是 【 自定义结构 】.

设置方式如下:

进入wordpress后台系统首页, 点击菜单 【设置】- 【固定链接】




选择【常用设置】 下的 【自定义结构】 , 可选择单个标签或多个标签组合, 可自定义拼接字符串, 本站点使用的是 /%post_id%.html, 填写完毕后, 点击 【保存更改】即可生效.



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即可生效, 恢复正常访问.

systemctl restart nginx.service