2011-10-28 113 views
0

我最近開始使用codeigniter,並且我已將它寄存在Bluehost的這裏:http://dev.fuelingtheweb.com/codeigniter/從codeigniter中的url中刪除index.php

如果我在這樣的路徑中包含index.php:/codeigniter/index.php/hello,一切正常,但如果我嘗試訪問頁面沒有index.php像這樣:/ codeigniter/hello,我獲得500內部服務器錯誤。我嘗試了許多.htaccess選項,但似乎沒有任何工作。

目前,我的.htaccess文件是定位在這裏:/codeigniter/.htaccess,它包括以下代碼:

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

<IfModule !mod_rewrite.c> 
    ErrorDocument 404 index.php 
</IfModule> 

而且,我的配置文件(/codeigniter/application/config/config.php)包括以下內容:

$config['index_page'] = ''; 
$config['uri_protocol'] = 'AUTO'; 

我嘗試了所有5個協議選項,但沒有成功。

任何幫助,這將不勝感激。

回答

2

你試過用戶指南中的一個嗎?

http://ellislab.com/codeigniter/user-guide/general/urls.html

+0

OK,在這個共約3小時後消費,我學到了很重要的一課:科達不喜歡.htaccess文件。我在服務器上的右邊文件夾中成功地獲得了一個.htaccess文件,但每當我「發佈」文件的更改時,.htaccess文件顯然都沒有實際推送到服務器。所以,我的變化都沒有做出。所以,我使用Dreamweaver來編輯文件,現在它工作正常。 – fuelingtheweb

+0

這是我現在使用的代碼: RewriteEngine敘述上 的RewriteCond $ 1→(索引\ .PHP |圖片|機器人\ .TXT) 重寫規則^ $ /codeigniter/index.php/$1 [!(*)。 L] – fuelingtheweb