Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

301 non-www to www except for one directory

Need to let requests for one directory pass through without redirecting

5:11 pm on Mar 12, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:Sept 16, 2003
votes: 0

We've recently migrated our website technology to a new platform and have set up a CNAME record to point www.example.com to the new server.

The A record for example.com points at our old server and we use the following .htaccess to redirect requests for example.com to the new site.

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com
RewriteRule ^(.*)$ http://www.example.com/$1 [R=permanent,L]

We'd like requests for example.com/images to pass through without any 301 redirects though. Can anyone give me pointers on how to modify our .htaccess to accomplish this?
8:36 pm on Mar 12, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2002
votes: 0

Place this condition ahead of the existing ruleset:
RewriteCond %{REQUEST_URI} !/images