Nginx下配置Typecho 1.2.0伪静态,单独写下前半段代码会造成403 NOT FOUND,单独写下后半段代码会造成404 - 页面没找到!
- 在Nginx的配置文件中,编辑Typecho站的配置;
- 在其中添写入如下代码:
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php$1 last;
}
location / {
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;
}
}
3.子目录typecho站点伪静态规则
location /子目录名/ {
if (!-e $request_filename) {
rewrite ^(.*)$ /子目录名/index.php$1 last;
}
}
评论 (0)