View Full Version : Force Preferred Domain Access

07-26-2013, 02:49 PM
We were told by an SEO company trying to sell us on their services that:
"Be careful, your server IP is not forwarding to your website's domain name. Search engines like GoogleTM are now able to index your
website with its IP instead of its domain name. This will result in duplicate content.
To check this for your website, enter your IP address in the browser and see if your site loads with the IP address. Ideally, the IP should
redirect to your website's URL or to a page from your website hosting provider.
If it does not redirect, you should do an htaccess 301 redirect to make sure the IP does not get indexed. "

So to solve that problem I wrote this simple contribution that detects if the page was accessed using a name (or IP address) that does not match the one used by default for the catalog (such as mydomain.com instead of www.mydomain.com) and if that is the case immediately redirect to the same page with the same parameters except using the preferred domain for the catalog. If you use separate domains for SSL and non-SSL access this contribution will maintain those domains as the domain checked is based on the current request type.

More... (http://addons.oscommerce.com/info/8866)