这个是URL重写的问题. 如果是apache就不会出现这问题了.因为apache支持.htaccess,在.htaccess中TP官方已经帮你写好了重写规则 但是在Nginx中不支持.htaccess只能自己去写重写规则. 可以用try_files来实现URL重写.下面这是我的laravel项目重写,你可以参考下! location / { try_files $uri $uri/ /index.php?$query_string; } 全部Nginx配置 server { listen 80; #listen [::]:80; server_name yourdomain.com; index index.php index.html index.htm default.html default.htm default.php; root /home;#你的项目下能直接访问到Index.php入口文件的目录 #如我的index.php在/home/index.php则这里配置到/home; include other.conf; #error_page 404 /404.html; include enable-php.conf; location / { try_files $uri $uri/ /index.php?$query_string; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } location ~ /\. { deny all; } access_log /home/access.log; #成功访问日志地址如:/home/access.log; } 具体详细的你可以百度nginx URL重写! 参考资料:百度搜索 google搜素
这个是URL重写的问题.
如果是apache就不会出现这问题了.因为apache支持.htaccess,在.htaccess中TP官方已经帮你写好了重写规则
但是在Nginx中不支持.htaccess只能自己去写重写规则.
可以用try_files来实现URL重写.
下面这是我的laravel项目重写,你可以参考下!
全部Nginx配置
具体详细的你可以百度nginx URL重写!
参考资料:
百度搜索 google搜素