为了账号安全,请及时绑定邮箱和手机立即绑定

如何解决在 LiteSpeed 服务器上找不到 PHP 页面

如何解决在 LiteSpeed 服务器上找不到 PHP 页面

PHP
MMTTMM 2022-07-16 10:43:50
我有以下 PHP 文件的布局├── classes/├── migrations/├── public/│   ├── images/│   ├── scripts/│   ├── styles/│   └── index.php├── sample/└── templates/我不确定如何将它放在我的服务器上,所以我将文件从public我的public_html文件夹中(这是我的 cPanel 已经拥有的)。此外,我将其他目录放在同一级别,public_html以保持项目的正常结构。因此,我最终得到了这个:├── (some cPanel directory and files)├── classes/├── migrations/├── public_html/│   ├── images/│   ├── scripts/│   ├── styles/│   └── index.php├── sample/├── templates/└── (other cPanel directory and files)现在,除索引页面外,所有其他页面都返回 HTTP 状态代码 404。我究竟做错了什么?作为参考,我尝试部署的项目可在https://github.com/srv-twry/Quizzer获得。
查看完整描述

1 回答

?
九州编程

TA贡献1785条经验 获得超4个赞

在您的源中没有.htaccess,并且听起来好像缺少重定向。


您需要通过前端控制器路由适当的 URL - index.php.


使用 Apache 风格的服务器,您可以使用modrewrite一个.htaccess文件。


作为起点,.htaccess使用以下规则创建一个 - 您可能需要根据您的个人需求进行调整;


RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-s

RewriteCond %{REQUEST_FILENAME} !-l

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^.*$ index.php [NC,L]

从网站管理员 Stackexchange复制的代码。


查看完整回答
反对 回复 2022-07-16
  • 1 回答
  • 0 关注
  • 69 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号