我在我的本地机器上创建了CodeIgniter项目(运行完美),然后我上传到带有数据库的服务器,但我面临的问题是在打开管理面板时没有发现错误。
我更改了配置文件(基本URL),database.php
(用于数据库连接)。但我不知道在.htaccess
文件中要改变什么,我采用了默认的CodeIgniter .htaccess文件,但它显示未找到错误。 htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /crescent_test/ad_crescent/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
试试这个更新的代码。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>
如果这不起作用,请访问以下链接:
Page isn't working and returns HTTP error 500 in CodeIgniter
你可以试试这个:
添加htaccess文件YOUR_ADMIN_FLODER root
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /YOUR_ADMIN_FLODER_NAME/
Options -Indexes
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /YOUR_ADMIN_FLODER_NAME/index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /YOUR_ADMIN_FLODER_NAME/index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /YOUR_ADMIN_FLODER_NAME/index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /YOUR_ADMIN_FLODER_NAME/index.php
</IfModule>