.htaccess tutorial

htaccess Elite


Exclude one folder from being re-writen.

Ask your mod_rewrite and Redirection questions here, and get answers!

Exclude one folder from being re-writen.

New postby kremo5le » 12 Mar 2010 05:48

Hello everyone,

I have the rule to re-write every non-www into a www. However, there is one folder I want to exclude as when I try to access it without the www it generates an error. I know it can be done, and I have seen the solution online, yet I don't quite know what to write to get it done. Here's how my .htacces looks like for the mod_rewrite part:

RewriteEngine On
RewriteBase /
RewriteRule ^(press_kit) - [L]
RewriteCond %{HTTP_HOST} !^www\.site\.com$ [NC]
RewriteRule ^(.*)$ http://www.site/$1 [R=301,L]

Now, in order to avoid this issue for the "press_kit" folder, what do I have to add to make it work with or without the www?

Thank you before hand,

k.
User avatar
kremo5le
 
Posts: 1
Joined: 12 Mar 2010 05:42
Location: San Diego, CA

Return to Redirect or Rewrite Questions