Redirect domain.com to www.domain.com, universal
- July 3rd, 2009
- By jrod
- Write comment
I still get allot of these requests, so I thought I would share this. You can add this rewrite rule to the .htaccess file located at the domains documentroot or in the virtualhost or directory context of the apache configuration to achieve the desired result.
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule (.*) http://www.%{HTTP_HOST}$1 [QSA,R=301,L]