server-administration:redirect-non-www-to-www
This is an old revision of the document!
Redirect non-www Traffic to www Using mod_rewrite
This is an example using the mod_rewrite Apache module to force all traffic to your site to www.yourodmain.com. This can be useful in an SSL context, as well as for SEO purposes. Create a .htaccess file in your webroot (public_html for cPanel servers) and add the following lines:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^your-domain.com
RewriteRule (.*) http://www.your-domain.com/$1 [R=301,L]
server-administration/redirect-non-www-to-www.1255564389.txt.gz · Last modified: by garrett.plasky