2013-04-03 60 views
0

我在我的虛擬主機中使用RewriteMap強制所有URL爲小寫字母。強制使用小寫字母的URL,但排除某些目錄

但是,我想排除某些目錄和內容被強制爲小寫。這可能嗎?這是我當前的htaccess,所以我想知道是否有人可以告訴我,我需要添加什麼規則/條件來排除/ static /和/ media /目錄被強制爲小寫。

<IfModule mod_rewrite.c> 

    RewriteEngine On 

    # Don't redirect these 
    #RewriteRule \.(gif|jpe?g|png|css|js)$ - [NC,L] 

    # Always remove any trailing slashes 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteCond %{REQUEST_URI} ^(.+)/$ 
    RewriteRule ^(.+)/$ /$1 [R=301,L] 

    # Removes index.php 
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC] 
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ /index.php/$1 [L] 

</IfModule> 

謝謝。

回答

0

這是非常可能的。您上面的.htaccess代碼不顯示任何將URI轉換爲小寫的代碼。如果這些規則在httpd.conf那麼最好把這些東西移到你的.htaccess中,這樣你就可以從一個地方控制/管理所有的重寫規則。一旦這些規則在.htaccess中,您可以有這樣的規則來避免降低某些URI:

# if URI doesn't contains INDEX. then convert to lowercase 
RewriteCond %{REQUEST_URI} !/INDEX\. 
RewriteRule ^(.*?[A-Z]+.*)$ ${lc:$1} [R,L] 
相關問題