2014-10-28 69 views
1

我已經開始使用codeigniter,並且想要移除在/testing_palace/index.php/home/testing_palace/home之間工作的localhost中的index.php.htaccess在codeigniter中不起作用

我google'ed這個問題,並嘗試提出的解決方案,但沒有爲我工作。

我在配置改變base_url和索引頁

$config['base_url']= 'http://localhost/testing_palace/'; 
$config['index_page'] =""; 

,並啓用了Windows下的Apache檢查mod_rewrite

這裏是我的.htaccess代碼

RewriteEngine On 
RewriteBase /testing_palace 

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

所有這些解決方案是不是爲我工作越來越沒有發現錯誤。

not found error in codeigniter

+1

你錯過了在規則斜線,它應該是'RewriteBase/testing_palace/' – Prix 2014-10-28 06:13:13

+0

謝謝你的迴應,我試過它不適合我。 – 2014-10-28 06:19:00

+0

@Mohit Jain我檢查了mod_rewrite已啓用,並遵循你給它不適合我的步驟.. – 2014-10-28 06:31:57

回答

1

有你/testing_palace/.htaccess這樣的:

RewriteEngine on 

RewriteBase /testing_palace/ 

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

然後/testing_palace/application/config/config.php你需要有這些配置設置:

$config['base_url'] = ''; 
$config['index_page'] = ''; 
$config['uri_protocol'] = 'AUTO'; 
+0

我試過它不工作...我的htaccess文件路徑testing_palace/application/.htaccess – 2014-10-28 06:38:52

+0

上面.htaccess我建議應該放在'/ testing_palace/.htaccess'而不是'/ testing_palace/application /' – anubhava 2014-10-28 06:39:47

+1

非常感謝你...我的問題解決了。 – 2014-10-28 06:43:09

1

使用下面的.htaccess。

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

我認爲它會幫助你。

+0

我試過它不工作,得到相同的錯誤。 – 2014-10-28 06:20:00