Right now, all my domains are setup as domain.com, so that if I type in http://www.domain.com, it takes the visitors to http://domain.com. How to I get the www to stay?
Add 'www' as a CNAME entry in the DNS Zone for your domain pointing to 'domain.com.' Also, make sure your webserver answers to both hostnames, domain.com and www. domain.com, at the same directory.
you have to add this in your db record: name ttl class rr canonical name www IN CNAME joe.example.com. You will need to do it as shown in the example so that the www works for your domain name you can read more about it here
If this is a Wordpress blog, you'll need to set the 'siteurl' and 'home' variable in phpMyAdmin or your wp-admin/ to include the www. If this is not Wordpress, you can use this mod_rewrite rule: # Require WWW # Will automatically redirect requests to non-www to www # This will exempt robots.txt for search engines <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/robots\.txt$ RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)$ [NC] RewriteRule ^(.*)$ http://www.%1.%2/$1 [R=301,L] </IfModule> Code (markup):