2016-05-12 98 views
0

当我在MAMA nginx中使用slim3.x时,遇到了404错误。我的routes/public/index.php代码是从这里:First Application WalkthroughMAMP slim nginx 404

我的目录是:/Applications/MAMP/htdocs/slimpro/routes/public/index.php

enter image description here

,我添加

location /slimpro { 
    root /Applications/MAMP/htdocs/slimpro/routes; 
    try_files $uri $uri/ /public/index.php?$query_string; 
} 

/Applications/MAMP/conf/nginx/nginx.conf

server { 

} 

我该如何解决这个404错误?

回答

0

在nginx中,您应该编辑您的nginx conf文件。

if (!-f $request_filename) { 
     rewrite ^(.*)$ /index.php last; 
} 

在Apache服务器,你应该编辑的conf

您可以添加重写规则

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-F 
RewriteRule . /index.php [L]