繁体   English   中英

在服务器上安装后,Codeigniter项目无法正常工作

[英]Codeigniter project is not working after installing at server

我构建了codeigniter项目,并已使用http:// localhost / wg /作为基本URL在本地计算机中对其进行了测试。 我将该项目上传到服务器,并且我的新URL(例如http://project.microsols.com/wardrobe/)正在运行。 但是,当我单击任何其他链接时,它将给出错误。 它给

未找到
在此服务器上找不到请求的URL /index.php/person。
此外,尝试使用ErrorDocument处理请求时遇到404 Not Found错误。

但是,当我将index.php放在控制器之前时,它将正常工作。这是我的.htaccess文件:

RewriteEngine on
RewriteBase /wardrobe/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ index.php/$1 [L,QSA]

这个错误背后的问题是什么?

将此代码粘贴到您的.htaccess文件中,然后尝试:

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

它将正常工作。

默认情况下,codeigniter网址在网址中包含index.php。 您需要从网址中删除index.php才能使其正常工作。 请按照此处的答案进行相同的操作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM