安装在根目录下,调用typecho.conf
内容为:
location /
{
index index.html index.php;
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;
}
}
安装在子目录下,调用typechosub.conf
内容为:
location /content/ {
if (-f $request_filename/index.html){
rewrite (.*) $1/index.html break;
}
if (-f $request_filename/index.php){
rewrite (.*) $1/index.php last;
}
if (!-f $request_filename){
rewrite (.*) /content/index.php last;
}
}
其中content为子目录的名字
————————————————
[nginx环境]Typecho安装在根目录与子目录的伪静态规则
安装在根目录下:
复制代码
1 location / {
2 index index.html index.php;
3 if (-f $request_filename/index.html){
4 rewrite (.*) $1/index.html break;
5 }
6 if (-f $request_filename/index.php){
7 rewrite (.*) $1/index.php;
8 }
9 if (!-f $request_filename){
10 rewrite (.*) /index.php;
11 }
12 }
复制代码
安装在子目录下:
复制代码
1 location /subfolder/ {
2 if (-f $request_filename/index.html){
3 rewrite (.*) $1/index.html break;
4 }
5 if (-f $request_filename/index.php){
6 rewrite (.*) $1/index.php last;
7 }
8 if (!-f $request_filename){
9 rewrite (.*) /subfolder/index.php last;
10 }
11 }
复制代码
推荐本站淘宝优惠价购买喜欢的宝贝:
本文链接:https://hqyman.cn/post/8861.html 非本站原创文章欢迎转载,原创文章需保留本站地址!
休息一下~~