ThihnkPHP项目部署到服务器上只能显示主页

ThihnkPHP项目部署到服务器上只能显示主页,点击任何URL都是首页的原因是根目录下.htaccessm文件出了问题,
当ThinkPHP项目运行在本地服务器上时内容应该是

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule(.∗) index.php [L,E=PATH_INFO:$1]
</IfModule>

里面主要起作用的是RewriteRule(.∗) index.php [L,E=PATH_INFO:$1]代码,
当当ThinkPHP项目运行在线上服务器上时内容应该是

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

如果内容对应错误,就会出现在线上服务器时会出现所有url都是首页,
线下部署时会出现No input file specified错误。
具体为啥还在思考中。。。。。。。。。

猜你喜欢

转载自blog.csdn.net/qq_43767886/article/details/116032636