Magento Forum

   
Help your direct traffic get to your site! 
 
readmanr
Jr. Member
 
Total Posts:  29
Joined:  2009-02-17
Yorkshire, England, Great Britain, United Kingdom
 

I had this idea over the weekend, I thought I would share it with you all.

Ask yourself, how many times have you gone to type a website in and missed a w off, or done an extra one!?
(ww.domain… wwww.domain...)

Everyone must have once or twice, then all you have to do is simply correct it.

But there is an easy fix to make sure this does not happen to your websites.

In your DNS settings for your domain, create the extra subdomains ww.domain.co.uk and wwww.domain.co.uk IN CNAME.

Open your apache conf file, get to the Virtual Host with your domain in, and where you have.

ServerName domain.co.uk
ServerAlias www.domain.co.uk

Simply add two new lines with ServerAlias ww.domain.co.uk and ServerAlias wwww.domain.co.uk
Restart Apache and test it out (you may need awhile (upto 48hours max) for ww.domain.co.uk to start working.

You should now see ww.domain.co.uk and wwww.domain.co.uk load up your website. But we dont want this duplicate content due to the URL displaying different information.
Open your .htaccess file browse to the section that says “rewrite engine on”

Add the following code…

RewriteCond %{HTTP_HOST} ^domain\.co\.uk[NC,OR]
RewriteCond 
%{HTTP_HOST} ^ww\.domain\.co\.uk[NC,OR]
RewriteCond 
%{HTTP_HOST} ^wwww\.domain\.co\.uk[NC]
RewriteRule 
^(.*) http://www.domain.co.uk/$1 [L,R=301]

The first line will redirect http://domain.co.uk/ to http://www.domain.co.uk/, and the 2nd and 3rd lines will move the ww. and wwww. to http://www.domain.co.uk/

Now when anyone makes this simply mistake they are automatically at your site.

This rewrite also helps anyone who types a link to a deep page wrong also.

i.e. if they type ww.domain.co.uk/cat/sub/product.html it will move it to the www.domain.co.uk/cat/sub/product.html page automatically.

If you get alot of direct traffic you can go further and register wwwdomain.co.uk for anyone who may miss the dot(.) out and then send them to www.domain.co.uk
(Only worth doing when you receive alot of direct traffic)

Hope this helps.

Thanks for listening,

Rob.

 
Magento Community Magento Community
Magento Community
Magento Community
 
natureday
Jr. Member
 
Avatar
Total Posts:  1
Joined:  2009-05-19
WA state
 

google is pretty smart too about it.
If you type in a domain name without the www and without the .com , it will still work in the browser if the domain name is popular.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top