Nginx环境配置子目录WordPress站点伪静态规则

2015年10月22日21:47:30网站建设评论921

apache环境下通过简单的配置.htaccess文件即可实现wordpress及子目录下wordpress站点的伪静态,但在nginx环境下就没那么简单了,我们需要通过修改nginx配置文件才能实现。文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

wordpress官方给出的nginx环境伪静态配置规则是,打开 nginx.conf 或者某个站点的配置环境(例如:duoluodeyu.com.conf),在 server { } 大括号里面添加下面的代码:文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

location / {
try_files $uri $uri/ /index.php?$args;
}文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

通过以上规则,我们还能延伸出wordpress站点在子目录下的伪静态设置规则(以son子目录为例):文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

location /son/{
try_files $uri $uri/ /son/index.php?$args;
}文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

伪静态规则设置完成后,重启Nginx服务即可使规则的生效。文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

相关文章推荐:Nginx环境配置WordPress伪静态规则文章源自堕落的鱼-https://www.duoluodeyu.com/1880.html

常用正则表达式汇总 网站建设

常用正则表达式汇总

很多不太懂正则的朋友,在遇到需要用正则校验数据时,往往是在网上去找很久,结果找来的还是不很符合要求。所以我最近把开发中常用的一些正则表达式整理了一下,在这里分享一下。给自己留个底,也给朋友们做个参考。...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定