2014-03-14 53 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>