Print this page
How to make a redirect from yoursite.com to www.yoursite.com
If you haven't made a redirect from yoursite.com to www.yoursite.com, your customers may face problems with making orders if they enter www.yoursite.com instead of yoursite.com. In other words, they will add products, but when going to the checkout they will see that their basket is empty. In order to fix this you are to make the following steps, namely:
1. Create an empty file named '.htaccess' in your public_html_folder.
2. Fill it with the below text:
RewriteEngine On
RewriteCond %{SERVER_PORT} ^80$
RewriteCond %{HTTP_HOST} ^yoursite.com$
RewriteRule ^(/)?(.*) http://www.yoursite.com/$2 [R=301,L]
or an alternative text:
RewriteCond %{HTTP_HOST} ^site.com$ [NC]
RewriteRule (.*) http://www.site.com/$1 [R=301,L,QSA]
3. Save the file, and enter the address: 'yoursite.com' in the browser's bar. If you have made the first two steps correctly, then you will see that yoursite.com is redirected to www.yoursite.com. This means that you have done the trick!