thinkphp项目部署在phpstudy出错
Not Found
The requested URL /About/index/classid/1 was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
出现该种情况是网站根目录下的.htaccess中没有内容又或内容出错。
如下图.htaccess中是没有内容的。
此时我们需要添加一段代码到.htaccess文件中,代码如下:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>
之后网站还是不可以,但显示的不是Not Found The requested URL /About/index/classid/1 was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
显示的是No input file specified.
显示该种错误是因为.htaccess文件中的
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
在默认情况下会导致No input file specified.
所以我们把上述代码替换成
RewriteRule ^(.*)$ index.php [L,E=PATH_INFO:$1]
即可解决