thinkphp框架部署出现404解决


1:虚拟机配置文件修改:

1 location / {
2   index index.php index.html;
3   if (!-e $request_filename) {
4     rewrite ^/index.php(.*)$ /index.php?s=$1 last; #必须在前面
5     rewrite ^(.*)$ /index.php?s=$1 last;
6     break;
7   }
8 }

2:项目入口文件:.htaccess

1 
2 Options +FollowSymlinks -Multiviews
3 RewriteEngine On
4 
5 RewriteCond %{REQUEST_FILENAME} !-d
6 RewriteCond %{REQUEST_FILENAME} !-f
7 RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
8 
tp