0
点赞
收藏
分享

微信扫一扫

WhatSNS nginx二级目录伪静态


在二级目录安装WhatSNS之后想要伪静态,参考官方的文档:​​https://wenda.whatsns.com/article-14574.html​​ 结果一直404 错误。

if (!-e $request_filename) {
rewrite ^/(.*)$ /二级目录名/index.php?$1;
}

location ^~ /view {
deny all;
}

因为自身本身就是个小白,也不会nginx ,一直在网上找对应的教程来做修改,结果发现都是同样的方式,可是依旧没有解决问题。

作为白嫖党的我肯定不想掏腰包找人解决问题啊,没办法只好一个个看nginx的教程。

最终发现,因为是二级目录,本身的目录是已经伪静态了,根本不需要在为二级目录写伪静态,直接rewrite二级目录就ok

在原本rewrite的基础上,在添加一句rewrite就可以。

if (!-f $request_filename){
rewrite (.*) /index.php;
rewrite (.*) /二级目录/index.php;
}

该方式有时候会影响到主站伪静态。

就酱紫~~~~~木得办法,自己太菜了~~~~~~~~~~

 

更新第二种方式:

location / {
index index.html index.htm index.php l.php;
autoindex off;

if (!-e $request_filename)
{
#地址作为将参数rewrite到index.php上。
rewrite ^/(.*)$ /index.php/$1 last;
}
}

location /demo/ {
index index.html index.htm index.php l.php;
autoindex off;
#demo为二级目录名称,记得修改
if (!-e $request_filename){
rewrite ^/demo/(.*)$ /shuicao/index.php/$1 last;
}
}

 

举报

相关推荐

0 条评论