исключение codeigniter htaccess для конкретной папки - PullRequest
0 голосов
/ 01 ноября 2011

Ниже приведен мой htaccess-файл для настройки codeigniter, который преобразует a / b в index.php / a / b. Однако я хочу добавить исключение, что если a = cometchat, то он не будет перезаписывать.

Пожалуйста, помогите

<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>

1 Ответ

0 голосов
/ 02 ноября 2011

Добавьте эту строку:

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>
...