Reputation: 4978
I am looking for a .htaccess redirect such that all request that come in for mydomain.com are redirected to www.mydomain.com. It is important tho that any sub domain request is not affected i.e. request for sub.domain.com should not be redirected.
If found this which seems to do the opposite of what I want:
RewriteCond %{HTTP_HOST} ^www\.purchase\.
RewriteRule (.*) http://purchase.DOMAIN_NAME/$1 [L,R]
Thanks in advance for your help
Regards Gabriel
Upvotes: 1
Views: 5040
Reputation: 652
rewritecond %{http_host} ^domain.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc]
Upvotes: 4