.htaccess concatenating www + subdomain I'm running a new Drupal 7 site on Ubuntu 14 (so no httpd.conf file), and am trying to make a simple htaccess rule to redirect from no subdomain to www. Basic stuff, the Internet told me what to do, and I used this:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


Problem is that if I put in a subdomain - something.domain.com - it concatenates the URL to www.something.domain.com

How can I get around this? It's... quite annoying. Perhaps a module would be a better solution than an .htaccess update?

(Also Global Redirect Case Sensitive URL Checking isn't working, but that's another story...)

Thanks.
If I understand you correctly, you want to redirect everyone to the www version of the site.
How about this.

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


It will redirect anything that isn't www.example.com to www.example.com and pass along the url.

http://httpd.apache.org/docs/2.4/rewrite/intro.html has more options you can use.