thinkphp项目部署在phpstudy出错,只有主页能打开
作者:程序员11 时间:2022-07-23 人气:637 QQ交流群\邮箱:1003265987@qq.comthinkphp项目部署在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 [ Q S A , P T , L ] 在 默 认 情 况 下 会 导 致 N o i n p u t f i l e s p e c i f i e d . 所 以 我 们 把 上 述 代 码 替 换 成 R e w r i t e R u l e ( . ∗ ) 1 [QSA,PT,L] 在默认情况下会导致No input file specified. 所以我们把上述代码替换成RewriteRule ^(.*)1[QSA,PT,L]在默认情况下会导致Noinputfilespecified.所以我们把上述代码替换成RewriteRule
(
.∗) index.php [L,E=PATH_INFO:$1]即可解决
欢迎阅读本文章,觉得有用就多来支持一下,没有能帮到您,还有很多文章,希望有一天能帮到您。