.htaccess codeigniter应用程序可以在hostgator上工作,但不能在其他web主机上工作

.htaccess codeigniter应用程序可以在hostgator上工作,但不能在其他web主机上工作,.htaccess,codeigniter,.htaccess,Codeigniter,我有一个codeigniter应用程序,它在我的hostgator托管域上运行得非常好 我已经配置了.htaccess和config.php以从URL中删除index.php。如前所述,这是工作100%。我现在需要将应用程序从我的hostgator服务器移动到南非的本地服务器(使用Afrihost) 修改后的htaccess和config文件如下所示: 我的htaccess文件是: RewriteEngine on RewriteBase / # Prevent CI index.php Re

我有一个codeigniter应用程序,它在我的hostgator托管域上运行得非常好

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

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

我的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
当我尝试浏览到域时,出现错误
,无法显示此页面

如果我浏览到我的ion auth控制器,我会收到404错误
该网页找不到

如果我浏览到我的完整codeigniter默认路径,我会得到错误
此页面无法显示

我假设这是一个htaccess配置错误,但是我不确定如何更正。读了很多文章,运气不好。或者,codeigniter中是否有其他配置设置支持此功能

我已经和新的托管公司Afrihost谈过了,他们说他们在这方面无能为力

如有任何建议/指示,将不胜感激


一如既往地感谢您。

请尝试在以下位置删除

RewriteRule ^(.*)$ /index.php?/$1
所以它是:

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

尝试在以下位置删除

RewriteRule ^(.*)$ /index.php?/$1
所以它是:

RewriteRule ^(.*)$ /index.php/$1
工作解决方案: htaccess文件以删除共享主机服务器上的index.php

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]
工作解决方案: htaccess文件以删除共享主机服务器上的index.php

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]

我同意这可能是一个访问问题。服务器规范(apache、php版本等)有什么不同?您可以访问服务器上的任何网页吗?如果您试图访问just/index.php或添加一个简单的/index.html文件,该怎么办?即使您的支持不支持您,他们也可以提供您的apache配置和/或错误日志。在另一台web主机上是否启用了mod rewrite?您是否在index.php文件中启用了错误报告?另外,您设置了什么样的路由?两台服务器的Apache版本都是2.2.23。旧服务器上的PHP版本是5.2.17,新服务器是5.3.20。感恩节路线是标准的,只是标准<代码>$route['default_controller']=“auth”$路由['404_覆盖']=''我同意这可能是一个访问问题。服务器规范(apache、php版本等)有什么不同?您可以访问服务器上的任何网页吗?如果您试图访问just/index.php或添加一个简单的/index.html文件,该怎么办?即使您的支持不支持您,他们也可以提供您的apache配置和/或错误日志。在另一台web主机上是否启用了mod rewrite?您是否在index.php文件中启用了错误报告?另外,您设置了什么样的路由?两台服务器的Apache版本都是2.2.23。旧服务器上的PHP版本是5.2.17,新服务器是5.3.20。感恩节路线是标准的,只是标准<代码>$route['default_controller']=“auth”$路由['404_覆盖']=''