PDA

View Full Version : Redirecting visitors.



ecampsite.co.uk
02 Nov 2005, 07:56 PM
Hi there,
I was just wondering what i'd need to do, so that if some types a url without the www., it still displays that webpage properly. Do you need some kinda code in a htaccess file. I want people to be able to type in "ecampsite.co.uk" and still see "www.ecampsite.co.uk". Just wondering whether anybody knows!!!
Thank you
Craig

Rincewind
02 Nov 2005, 09:51 PM
It depends on how your dns and apache config on the server is setup. Most people have it that www.example.com points to the same IP in the dns as example.com. Then they set apache so that both versions point to the same folder in the server. So typing in www.example.com/index.html will give you the same file as example.com/index.html.

There is a complication to this usualy setup. Some times the search engines view the two versions of the name as separate sites (as if www. is just a subdomain with identical content.) So the PR for the two domains remains separate. It doesn't hurt to give the search engines a hint that that both versions are the same place and which is your preferance. You make a 301 perminant redirect form one version to the other. It's up to you which version you redirect (personally I don't see the point of www. all the time any more.) This 301 redirect is done using a .htaccess file in your site. Just put in some code like this.


redirect 301 / http://www.example.com/

or if you prefer to default to not using the www.


redirect 301 / http://example.com/