2013-06-05 108 views
1

我:笨的mod_rewrite的根和子目錄

root/.htaccess

RewriteEngine on 
RewriteBase/

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

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

它完美地將所有請求(除了文件和文件夾)到的index.php。我需要它也可以用於我的子文件夾。
我的.htaccess中的子文件夾root/demos/project包含:

RewriteOptions inherit 

,但不起作用。

我試試這根/的.htaccess

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

不工作。

這樣的:

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

得到內部服務器錯誤 'missconfiguration'

,並多了幾分方式,但一切我想,我只是得到這些:501(從服務器默認)和404(從CI在根中);

我在rootdemos/project都使用codeigniter,只是想從兩個'隱藏'index.php,如何正確地做到這一點?

謝謝。

回答

0
RewriteEngine on 
RewriteRule ^(.*)$ /demo/project/index.php?/$1 [L] 

這是行不通的嗎?

你也可以在你的demo/project文件夾中放置另一個.htaccess。

編輯:

試試這個:

RewriteEngine On 
RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ /demo/project/index.php?/$1 [L] 

EDIT2:

如果你得到一個404未找到頁面只是改變你的config.php根/應用/配置/ config.php文件從以下幾點:

$config['index_page'] = "index.php"; 

到:

$config['index_page'] = ""; 
+0

內部服務器錯誤'missconfiguration'。 :( – egig

+0

看到我的編輯,當我刪除2請求時它工作嗎? –

+0

還是一樣的:'500內部服務器錯誤'。我添加.htaccess到我的子文件夾太類似sintax,我試過的一切,我只得到這些:500或404。當你得到404它應該工作。 – egig