2015-11-17 47 views
0

當我在我的本地機器上粘貼.htaccess文件代碼時,它可以正常工作,就像我的網址沒有index.php一樣正常,但是當我將相同的代碼上傳到linux服務器時,url再次需要index.php有人指導我如何刪除Linux服務器上index.php ...Codeigniter在linux服務器中刪除index.php

這是我.htacces代碼

RewriteEngine on 
RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

這是我的.htaccess代碼和我在我的本地Windows機器上解釋了這個做工精細但是當我上傳相同的代碼到Linux服務器,然後我的rounting引擎不起作用

+0

檢查服務器上的mod_rewrite啓用 –

+0

我們既沒有您的.htaccess文件,也沒有您的index.php文件,我們也沒有錯誤信息,我們怎麼可能知道哪裏出了問題? – sadaf2605

+0

RewriteEngine敘述上 的RewriteCond $ 1→(索引\ .PHP |資源|機器人\ .TXT)!!! 的RewriteCond%{} REQUEST_FILENAME -f 的RewriteCond%{} REQUEST_FILENAME -d 重寫規則^ $ index.php文件(*)。/$ 1 [L,QSA] –

回答

0
  1. 確保國防部重寫導通,在您的服務器。
  2. 另外請確保.htaccess文件位於您的index.php所在的相同文件夾中。
0

添加該代碼在你的htaccess文件

RewriteEngine On 
RewriteBase/

RewriteCond %{REQUEST_URI} ^system.* 
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt) 
RewriteRule ^(.*)$ /index.php/$1 [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L,QSA] 

希望這個代碼可以幫助!

0

我建議在與應用程序文件夾相同的級別設置.htaccess,並在其中放入以下代碼。

Options +FollowSymLinks 
RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule^index.php [L]