301 redirect non-www to www, without affecting subdomains?

kontrabass

Well-known member
So I want all URL's redirecting to www. if it's missing the www. This does it, located in my apache .conf file under my root directory:

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


But, how do I exempt other hostnames from getting redirected? For example, I want to put static stuff on a cdn at static.talkbass.com. When loading http://static.talkbass.com/styles/talkbass/xenforo/logo_small.png you're redirected to http://www.talkbass.com/styles/talkbass/xenforo/logo_small.png

Hmm.
 
Back
Top Bottom