1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'Server Configuration and Hosting' started by kontrabass, Jul 16, 2014.

  1. kontrabass

    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

  2. Slavik

    Slavik XenForo Moderator Staff Member

    kontrabass likes this.

Share This Page