htaccess redirect to www excluding subdomains both https and http

Posted by wes on Stack Overflow See other posts from Stack Overflow or by wes
Published on 2010-05-25T19:38:38Z Indexed on 2010/05/25 19:41 UTC
Read the original article Hit count: 162

Filed under:

So this is what I currently have, I'm trying to redirect http://something.com to http://www.something.com but if its a subdomain do no such things, so http://other.somethings.com will stay the same AND conditional based on https/http

Currently have..

RewriteCond %{HTTP_HOST} !^www.

RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

© Stack Overflow or respective owner

Related posts about htaccess