0

我有一个在我的 hostgator 托管域上完美运行的 codeigniter 应用程序。

我已配置 .htaccess 和 config.php 以从 URL 中删除 index.php。如前所述,这是 100% 工作的。我现在需要使用 Afrihost 将应用程序从我的 hostgator 服务器移动到南非的本地服务器。

修改后的 htaccess 和配置文件如下所示:

我的 htaccess 文件是:

RewriteEngine on
RewriteBase /

# Prevent CI index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L] 

# Prevent user access to the CI system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L] 

# Prevent user access to the CI application folder
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

我的 config.php 文件是:

$config['base_url'] = 'http://logicoportal.co.za';
$config['index_page'] = '';
// let me know if you need to see any other setting

当我尝试浏览域http://www.logicoportal.co.za时出现错误This page can't be displayed

如果我浏览到我的 ion auth 控制器, http: //logicoportal.co.za/auth/login我得到 404 error The webpage cannot be found

如果我浏览到完整的 codeigniter 默认路径http://logicoportal.co.za/index.php/auth/login我会收到错误This page can't be displayed

我假设这是一个 htaccess 配置错误,但我不知道如何纠正这个问题。读了很多没有运气的文章。或者,codeigniter 中是否有另一个配置设置来支持这一点?

我已经与新的托管公司 Afrihost 进行了交谈,他们说在这方面他们无能为力。

任何建议/方向将不胜感激。

一如既往地感谢。

4

2 回答 2

4

工作解决方案:在共享托管服务器上删除 index.php 的 htaccess 文件

DirectoryIndex index.php
RewriteEngine on

RewriteCond %{REQUEST_URI} !^(index\.php|\.swf|forums|images|css|downloads|js|robots\.txt|favicon\.ico)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) ./index.php [L]
于 2013-03-06T06:48:03.600 回答
1

尝试删除?in:

RewriteRule ^(.*)$ /index.php?/$1

所以这是:

RewriteRule ^(.*)$ /index.php/$1
于 2013-03-05T07:58:44.377 回答