开发者

Mod ReWrite - How do you provide an exception for a particular directory?

There are a couple of directories that I would like ModRewrite to ignore. How is this accomplished? Right now if I try to create a new subdirectory and I place an index.html file in there and call it explicitly it works, however if I just hit the directory the index file is not loading and I think its something in the code below.

Here is the htaccess file

#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]
RewriteRu开发者_开发知识库le 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


RewriteRule ^(first_dir|second_dir|third_dir) - [L]

the rest of the rules go below this line


I believe that, as with all apache directives, you can just wrap it in a <DirectoryMatch> tag, and specify which directories to be included as appropriate:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜