Do I care whether I do or don't use the www to access my domain?
Oct252012
You sure do!
- From an SEO (Search Engine Optimization) standpoint, you'll get dinged for "duplicate content" if your website responds to both www.yoursite.com and yoursite.com.
- From a Zen Cart standpoint, the HTTP_SERVER and HTTP_CATALOG_SERVER settings in your /includes/configure.php and /YOUR_ADMIN/includes/configure.php files should reflect whether you do or don't use the www.
- When you purchase an SSL certificate for your site, make sure that the domain you specify is based on whether or not you use the www.
How do I force the www to be used to access my site?
Edit the .htaccess file in the root of your store's file system to include the following. The RewriteCond statement allows the same file to be used both for your localhost installation and your hosted version.
RewriteEngine On RewriteCond %{HTTP_HOST} !(^www\.yoursite\.com$|^localhost$) [NC] RewriteRule ^(.*)$ http://www.yoursite.com/$1 [L,R=301]
How do I remove the www from all accesses to my site?
Edit the .htaccess file in the root of your store's file system to include the following. The RewriteCond statement allows the same file to be used both for your localhost installation and your hosted version.
RewriteEngine On RewriteCond %{HTTP_HOST} !(^yoursite\.com$|^localhost$) [NC] RewriteRule ^(.*)$ http://yoursite.com/$1 [L,R=301]