Fragmented Thought

.htaccess no subdomain redirect

By

Published:

Lance Gliser

Heads up! This content is more than six months old. Take some time to verify everything still works as expected.

I'm not fond of the .htaccess shipped with Drupal, or at least not the redirection lines they suggest. I prefer not having to replace my sub domain. Also, I like having standard sub domains for development: dev., m., and local. I replace them with this:

RewriteCond %{HTTP_HOST} !^(www|local|dev|m). [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]