Normally you will want your users to browse to www.mydomain.com instead of mydomain.com. It is
good for search engine optimization to have one destination. It's also useful when you use
cookies to keep users logged on when they are accessing different subdomains i.e.
www.mydomain.com, shop.mydomain.com, forum.mydomain.com etc. You can use mod_rewrite to
achieve this. Put the following rule in your .htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [L,R]
NOTE: to use the above rule you must compile Apache with mod_rewrite. ISP's usually have
mod_rewrite enabled.
|