我尝试将 htaccess 的设定档丢到线上去转成 nginx 的
直接转的完全不能用
于是我参考了一下原理去改成这样
location / {
rewrite ^/admin/index$ /admin/templates/index.php;
rewrite ^/admin/handlers/([\w\-]+)$ /admin/handlers/$1.php;
rewrite ^/$ /public/templates/index.php;
}
我发现 /
, /admin/index
正常
但是我发现 /admin/handlers/
失效了,他会说「File not found.」
其实在该目录下是有档案的
反而要在后面加上 .php 才会有反应,例如「/admin/handlers/signin.php」
这是哪里设定错误了?
https://imgur.com/EbVsiDE
https://imgur.com/XzlmYUg
https://imgur.com/7n3QD1h
试着加上
last
或者break
标志。