下面是我的codeigniter设置的htaccess文件,它将/ 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>
答案 0 :(得分: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>