2011-04-27 57 views
0

有幾個目錄我想ModRewrite忽略。這是如何完成的?現在,如果我嘗試創建一個新的子目錄,並在其中放置一個index.html文件並明確地調用它,但是如果我只是點擊目錄索引文件沒有加載,我認爲它在下面的代碼中。Mod ReWrite - 如何爲特定目錄提供例外情況?

這裏是htaccess文件

#php_value upload_max_filesize  32M 
RewriteEngine On 

RewriteCond %{HTTP_HOST} programresidency\.com$ 
RewriteRule (.*) http://www.programresidency.org/$1?fr=residency.com [L,R=302] 

RewriteCond %{HTTP_HOST} programresidency\.net$ 
RewriteRule (.*) http://www.programresidency.org/$1?fr=programresidency.net [L,R=302] 

RewriteRule about-the-residency/professional-development.php about/professional_development.html [L,R=302] 
RewriteRule about-the-residency/placement-process.php about/placement_process.html [L,R=302] 
RewriteRule about-the-residency/about-education-reform.php about/education_reform.html [L,R=302] 
RewriteRule become-a-resident/selection-criteria.php become_a_resident/selection_criteria.html [L,R=302] 
RewriteRule become-a-resident/selection-process.php become_a_resident/selection_process.html [L,R=302] 
RewriteRule summer-residency/selection-process.php become_a_resident/summer_opportunities.html [L,R=302] 
RewriteRule about-residents-alumni/alumni.php student/alumni/overview.html [L,R=302] 
RewriteRule about-residents-alumni/resident-experiences.php student/experiences.html [L,R=302] 
RewriteRule about-residents-alumni/day-in-the-life.php student/day_in_life.html [L,R=302] 
RewriteRule about-residents-alumni/2007/ student/2007-2009.html [L,R=302] 
RewriteRule about-residents-alumni/2008/ student/2008-2010.html [L,R=302] 
RewriteRule information-sessions/ events.html [L,R=302] 
RewriteRule newsletters/?$ news/newsletter.html [L,R=302] 
RewriteRule media-center/press-releases.php news/press/index.html [L,R=302] 
RewriteRule media-center/articles.php news/articles/index.html [L,R=302] 
RewriteRule faq/?$ faq.html [L,R=302] 
RewriteRule index.php index.html [L,R=302] 

# we skip all files with .something 
RewriteCond %{REQUEST_URI} \..+$ 
RewriteCond %{REQUEST_URI} !\.html$ 
RewriteCond %{REQUEST_URI} !\.org 
RewriteCond %{REQUEST_URI} !\.xml$ 
RewriteRule .* - [L] 

# we check if the .html version is here (caching) 
RewriteCond %{REQUEST_FILENAME} !-f 

#Dev Apache 2.x 
RewriteBase/
RewriteRule !\.(js|ico|gif|jpg|png|css|php)$ hello.php 

回答

0

重寫規則^(first_dir | second_dir | third_dir) - [L]

的其餘規則走這條線

+0

RewriteRule的順序是否重要? RewriteRule index.php index.html [L,R = 302] – 2011-04-28 00:00:49

0

我相信下面,與所有apache指令一樣,您可以將其包裝在<DirectoryMatch>標記中,並指定將哪些目錄包含在適當的位置:

<DirectoryMatch "[^NotThisDir]"> 
    // all the Rewrite rules that you want to apply 
    // to everything except the NotThisDir directory 
</DirectoryMatch> 
+0

在我的腳本中,我可以實現您提供的代碼嗎? – 2011-04-28 00:00:05

+0

@JosephU。 - 更新回答你的問題 – eykanal 2011-04-28 00:41:23