2011-11-01 82 views
0

以下是我的codesetiter設置的htaccess文件,它將a/b轉換爲index.php/a/b 但是,我想添加一個異常,如果a = cometchat,那麼它會不做重寫。codeigniter htaccess特定文件夾的例外

請幫

<IfModule mod_rewrite.c> 

    # Make sure directory listing is disabled 
    Options +FollowSymLinks -Indexes 
    RewriteEngine on 

    # Keep people out of codeigniter directory and Git/Mercurial data 
    RedirectMatch 403 ^/(system|\.git|\.hg).*$ 

    # Send request via index.php (again, not if its a real file or folder) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 

    <IfModule mod_php5.c> 
     RewriteRule ^(.*)$ index.php/$1 [L] 
    </IfModule> 

    <IfModule !mod_php5.c> 
     RewriteRule ^(.*)$ index.php?/$1 [L] 
    </IfModule> 

</IfModule> 
+0

'的RewriteCond $ 1→(索引\ .PHP | cometchat)'是我RewruteRule之前(替換爲您除外) – danneth

+0

沒有..still沒有運氣:(! –

回答

0

加入這一行:

RewriteCond $1 !^(index\.php|folder1|folder2|img|shared) 

每個RewriteRule以上,並改變/添加文件夾。

這樣:

<IfModule mod_rewrite.c> 

    # Make sure directory listing is disabled 
    Options +FollowSymLinks -Indexes 
    RewriteEngine on 

    # Keep people out of codeigniter directory and Git/Mercurial data 
    RedirectMatch 403 ^/(system|\.git|\.hg).*$ 

    # Send request via index.php (again, not if its a real file or folder) 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 

    <IfModule mod_php5.c> 
     RewriteCond $1 !^(index\.php|folder1|folder2|img|shared) 
     RewriteRule ^(.*)$ index.php/$1 [L] 
    </IfModule> 

    <IfModule !mod_php5.c> 
     RewriteCond $1 !^(index\.php|folder1|folder2|img|shared) 
     RewriteRule ^(.*)$ index.php?/$1 [L] 
    </IfModule> 

</IfModule>