Pages: [1]   Go Down
Send this topic | Print
Author Topic: www or not?  (Read 544 times)
eckline
Authority Member
****
Offline Offline

Posts: 505



WWW
« on: September 25, 2008, 09:32:50 AM »

should i use www.  in my domain, whats the difference between that and if i dont use it?

also how do i redirect it from domain.com to www.domain.com

thanks
« Last Edit: September 25, 2008, 09:51:13 AM by eckline » Logged

inp o҉rtb
The Gangsta
Global Moderator
Official 110mb Guru
*****
Offline Offline

Posts: 15642


experimental theologian


WWW
« Reply #1 on: September 25, 2008, 10:18:35 AM »

That's like... the first search result: http://www.110mb.com/forum/empty-t31345.0.html
Logged

Hi! I’m a signature virus! Add me to your signature to help me spread.
spam me: ispamspot@gmail.com

blog | my work @ deviantART | Imagine-ng image editor
SoCalSubbuteo
Hyper-Active Member
***
Offline Offline

Posts: 361


WWW
« Reply #2 on: September 25, 2008, 01:56:14 PM »

Google regards www.your-site.com & your-site.com as 2 seperate web sites, therefore, if there are links to both URLs your site will suffer Google's duplicate content penalty & drop in their rankings.

If you are registered with Google Webmaster Tools (GWT) go to the 'Tools' tab & use the 'Set preferred domain' to set either the www or the non-www version of your site.

Ideally you would also want to have a 301 redirect (permenantly moved) from one to the other.  You can see how to do that using the .htaccess file as described in the previous post.
Logged

Playing Subbuteo in Southern California (socalsubbuteo.110mb.com)
islesv
Not Very Authoritative
Advanced Authority Member
*****
Offline Offline

Posts: 1016



WWW
« Reply #3 on: September 25, 2008, 06:09:06 PM »

Or if you don't have .htaccess, you can do it via PHP.
Logged

eckline
Authority Member
****
Offline Offline

Posts: 505



WWW
« Reply #4 on: September 26, 2008, 08:09:52 AM »

how do i do it through php
Logged

islesv
Not Very Authoritative
Advanced Authority Member
*****
Offline Offline

Posts: 1016



WWW
« Reply #5 on: September 27, 2008, 10:44:04 AM »

Code:
<?php

// redirect www.domain.com to domain.com
if(preg_match('/www\.'.$_SERVER['HTTP_HOST'].'/i', $_SERVER['HTTP_VIA']))
{
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
exit();
}

Logged

Pages: [1]   Go Up
Send this topic | Print
Jump to: