- Code: Select all
Options +FollowSymLinks
RewriteEngine On
# Force www.
RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
# Exclude these root directories
RewriteCond %{SCRIPT_FILENAME} !ROOT FOLDER TO EXCLUDE$
RewriteCond %{SCRIPT_FILENAME} !ROOT FOLDER TO EXCLUDE$
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
# Ignore real files (in your document root).
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule !^folder(/.*)?$ /folder%{REQUEST_URI} [QSA,L]
This seems to work really well. I have to update my links, but that is something I should probably do any way. The only thing I'd like to solve now is to force a redirect of:
www.domain.com/aSpecificFolder >> www.domain.com
I only want to force this redirect for one folder though. Not sure if this is possible.
Thanks again for all your help!