大家新年好b( ̄▽ ̄)d 虽然今天是大年初六了但是还是祝大家新年快乐,万事如意。

本来在之前的LANMP一键环境里Wordpress设置固定链接易如反掌直接设置的,但是我在最近在Windows系统下使用宝塔面板搭建的环境中安装的是Nginx而导致固定链接报404错误.
虽然Wordpress官方有相关教程,但是鉴于我英语水平的局限性和机翻的阅读可行性而不得不暂停搁置。这不在此刻空闲下来了就在就进行一番处理,经过搜索找到了中文说明为了方便以后搭建使用而特此记录。
以现在搭建的宝塔为例,在网站》设置》配置文件的server{里面加
###
location / {
root *:/***/***.com;
index index.php index.html index.htm;
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php;
}
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
###
经过我没技术的疏忽location / {里面的root *:/***/***.com;要和location ~ \.php$ {的路径一致否则会导致wp-admin无法访问。(废话,只是我现心急没看里面还有路径)
修改完成后重启Nginx就可以设置固定链接了。
参考:
http://blog.csdn.net/spring21st/article/details/50995156
https://codex.wordpress.org/Nginx
https://codex.wordpress.org/zh-cn:使用固定链接
超越自我吧
2018年2月21日
好文章!666,学习了
…过奖了~~~~