2014-03-14 59 views
0

我在我的项目中使用了坦克验证。在我的本地主机,它工作正常。但是,当我上传的项目到服务器上,我得到了错误的Htaccess不能在Codeigniter中工作

没有指定输入文件。

我知道这是因为htaccess。我的网址就像http://example.org/project/test/tankauth/。当我给这个URL时,它将重定向到http://example.org/project/test/tankauth/index.php/auth/login并显示错误。但是,如果我尝试使用像http://example.org/project/test/tankauth/index.php?/auth/login这样的网址,它将正常工作。

我htaccess文件如下图所示:

RewriteEngine on 
RewriteBase /tankauth/ 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 

我不是htaccess的好。

+1

检查mod_rewrite的是启用或不? –

+0

是启用 – Jenz

+0

更改'$ config ['index_page'] ='index.php';'为'$ config ['index_page'] =';;' – dhidy

回答

0

我假设你在这个上使用apache,我还假设你没有对你的apache配置/ etc/apache2 /进行任何修改,最后我假设你有一个访问你的服务器的权限,那么如果是这样的话,你可能要检查你的/ etc/apache2的/网站可用/默认http://httpd.apache.org/docs/2.2/mod/core.html#allowoverride

那里你会发现

<Directory /path/to/www/> 
Options Indexes FollowSymLinks MultiViews 
AllowOverride None <---change None to FileInfo or All 
Order allow, deny 
allow from all 
</Directory> 

然后重置你的Apache - >service apache2 restart or sudo service apache2 restart

抬头使用AllowOverride All可能会标记一些严重的漏洞问题,如果这是生产服务器,我建议您不要使用它。

希望它有帮助,欢呼!

0

试试这个(改变最后一行)

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

,并在应用/配置/ config.php文件

$config['uri_protocol']   ="PATH_INFO"; 
0

它的工作。

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