安装在非根目录的,也就是在二级目录下的 emlog pro ,nginx 配置 URL 重写的方法
独元殇 • 2023-06-11 21:58 • 357 次点击 •
在根目录下的 emlog pro,nginx 配置其 url 重写的方式是后台有了,就是在合适的位置比如根目录或者什么地方,写个 localhost.conf
内容如下
location / {
index index.php index.html;
if (!-e $request_filename){
rewrite ^/(.*)$ index.php last;
}
}
但极少情况下,我们将其安装在一些二级目录,那么上面这个办法是不起效的,那该怎么做呢?很简单,在第四行写上目录即可,比如你的目录是 /myblog/
location / {
index index.php index.html;
if (!-e $request_filename){
rewrite ^/(.*)$ /myblog/index.php last;
}
}