如何为 Nginx 重写此 Apache 重写规则?
RewriteCond %{REQUEST_URI} ^/api
RewriteRule (.*) index.php [L]
我试过了,但是没用,我进去HTTP 404
了/var/log/nginx/access.log
location @missing {
rewrite ^ $scheme://$host/index.php permanent;
}
答案1
像您问题中提到的,nginx 实现前端控制器模式的方法是:
location /api {
try_files /index.php =404;
}