A lot of publishers are losing page rank because they use two different domains -- one that begins with www and one that doesn't -- for the same site.
Most sites offer both forms of address to help users. For instance, you can reach the political analysis site MyDD at either mydd.com or www.mydd.com.
When you use two domains, pick one that's the real address and redirect the other address using an HTTP status code of "301 moved permanently," which indicates a permanent move, rather than "302 found," which may be temporary.
If you take another approach, Google's likely to treat them as different sites. For example, Google tracks 24,600 incoming links to www.mydd.com, giving the site PR 7, and 808 links to mydd.com, giving it PR 6.
The site's hosted with Apache, so if mod_rewrite is installed, a two-line .htaccess file in mydd.com's root directory will redirect requests to the real address with the proper HTTP code:
To see if your site could benefit from this technique, try both of its addresses as a Google search. If the number of results is different, Google thinks you're publishing two different sites and you're losing page rank. I know this affects all Manila-published sites, because I've experienced it at Buzzword and am abjectly begging UserLand for a fix, and other weblogging tools as well. Among the top 10 blogs on Technorati, only Dooce and Kottke.Org aren't giving up some rank.
Why not just create a CNAME record for www at your domain?
Do you have anything to back up the idea that Google treats example.com and www.example.com as the same site because they share an IP address? I use 301 referrals because I've seen that it works.
See Also: no-www.org
How do you actually do this redirect? Is is in the HTTP config file?
It can be put right in the httpd.conf; that's how I do it, because it's more centralized than putting htaccess files all over the place if you're hosting numerous sites (it, in theory, uses more memory, but I haven't noticed). In reference to CNAME: that is the reason for the 301 redirection; when two different URLS (www.thing.com and thing.com) point to the same server, spiders might consider them two different sites. With virtual hosting and iptables, you can have umpteen-brazillion domains on one IP address, so there's no indicator there of what should be lumped together and which should be treated separately.
In my personal experience, watching logs and rankings closely, I've noticed the effect of domain variations (also if you have domains like both 'www.my-site.com' and 'www.mysite.com') on rankings, but I never thought of using a 301 response to fix it. for the 40+ domains I host, I added the rewrite rule to all the domains in around 20 minutes, and it seems to work well. Hopefully it'll help our rankings!
I'll mention it here, since I'm not really documenting my change anywhere else: if you use a BASE tag in your HTML header, but the HREF property isn't the 'official' domain name, IE6 doesn't follow the 301 redirect and thinks the URLs are broken. It isn't uniformly broken across the board: the only place it seemed to be bad was for background images. It's a simple fix -- change the BASE tags to reflect the correct domain -- but I didn't notice it right away until confused users started emailing me about why pages were suddenly broken.
Roger,
(Pablo seems to be getting around your 3-links-per-comment restriction.)
I don't think this will make any difference. Having two fully qualified domain names in the wild will dilute their collected links and page rank, but rewriting isn't going to solve much of this problem.
Looking at the links to mydd.com, the first link was from fairshot.typepad.com They put mydd.com on their blogroll, not www.mydd.com. The same was true for the other two links I checked on the first page.
Since it is a working url, there is no incentive to change it. Changing it so that mydd.com no longer worked would anger more people than just the no-www.org folk.
I see that mydd.com hasn't implemented your suggestion yet, so that if someone came to mydd.com from one of these blogrolls and saw some item that they blogged, the link would contibute to the mydd.com rank and not to the www.mydd.com rank, so it might be worthwhile ot fix.
Does anyone really follow blogroll links? You'd probably have to claw through all the 1300 links to mydd.com to figure that out satisfactorily.
More significantly to me, if they aren't using www.mydd.com in their feeds, then they need to fix that.
(Checks.) They are, but they don't have autodiscovery and to add insult to injury, they only have the feeds on the front page and they don't use the orange icons for feeds. I'd say that not having autodiscovery is a more significant problem than mydd.com vs. www.mydd.com. Personally, if a site doesn't have autodiscovery for their feeds, I am not likely to subscribe.
I'm not recommending that mydd.com stop working. I'm recommending that it redirect to www.mydd.com with status code 301, which tells Google that mydd.com and www.mydd.com are the same site.
Right now, that fairshot.typepad.com counts towards the page rank of mydd.com, but it doesn't count towards www.mydd.com. MyDD's losing rank it has earned.
I guess I muddied my question.
If you do the redirect on the server side, is there any evidence that Google will lump the two urls for the purpose of page rank, since both urls will continue to exist on other pages?
Specifically, if mydd.com redirects to www.mydd.com and other sites continue to refer to it as mydd.com will www.mydd.com increase in page rank? Will mydd.com to to zero?
The evidence of the consolidation can be found in Google searches. When you search Google for cadenhead.org or www.cadenhead.org, the results are identical. Also, in both cases, Google displays the URL as www.cadenhead.org, the domain I'm using as the official URL.
Thanks!
I put this code in my .htaccess file:
RewriteEngine on
RewriteRule ^(.*) www.nudo-italia.com$1 [R=301]
Any ideas? Has anyone got this redirect code working?
Andy,
I had the same problem. Following Roger's suggestion, I tried the I put this rule in my httpd.conf. I discovered that his code relies on the two domains having separate document roots. If you put that rule into your document root for www.nudo-italia.com, you will endlessly redirect www.nudo-italia.com.
If you can't, or don't want to create a separate document root for the non-www form, try this:
RewriteEngine on
RewriteCond ${HTTP_HOST} !^www.nudo-italia.com
RewriteCond ${HTTP_HOST} !^$
RewriteRule ^/(.*) www.nudo-italia.com$1 [L,R=301]
which will redirect all host names except www.nudo-italia.com to www.nudo-italia.com. I guess that the "http:" part of the rewrite rule is optional. The "[L]" turns off rewriting on that url, which may or may not be what you want to do.
I stole this code from the Apache mod_rewrite page.
Thanks for the suggestion. I do rely on multiple document roots. I create one that redirects to the proper root, and then every domain to refer is a symlink to that redirector:
/www/www.cadenhead.org/html is the proper root
/www/redirect_to_cadenhead/html contains .htaccess and redirects to the proper root
/www/cadenhead.org symlinks to redirect_to_cadenhead
/www/prefect.com symlinks to redirect_to_cadenhead
/www/www.prefect.com symlinks to redirect_to_cadenhead
I've tried more complex mod_rewrite tricks in the past, but I always end up hosing them at some point.
Andy,
I lost a "/" in the RewriteRule between the "com" and the "$1". It should be:
RewriteRule ^/(.*) www.italia-nudo.com$1 [L,R=301]
Hi all,
I would like to know what happens if
"a domain that is parked for some years which has a PR6, when it is then hosted for the first time, will that domain lose its PR6?"
Thanks.
Rahim
www.webtrendz.co.uk
I have the same problem with my site the page with www is PR3 and the one w/out is PR1.
My host can't seem to help, all they do is send e-mails with suggestions that never work.
I can't use .htaccess because it only works on Linux, so I'm pretty much stuck, you would think that spiders could figure these kind of things out after a certain amount of time and rank both pages the same, since that's the only differance, besides www.
Thanks everyone for your helpful remarks. I found several instances on my site where the PR differs a lot with www vs non-www but in my case it was better without it
RewriteEngine on
RewriteCond %{HTTP_HOST} !^michaelthompson.org [NC]
RewriteRule ^(.*)$ michaelthompson.org%{REQUEST_URI} [R=301,L]<>
I recognised it before but i couldn't find out why it is so. you may be right.i looked your pages link count at seochat.com with two versions // and //www they differ a bit. i think the reason is the linking sites. they use both types so this happen. but i'm not sure. we may ask to google(or others SE's) stuff.
> Thanks for the suggestion. I do rely on multiple document roots.
> I create one that redirects to the proper root, and then every
> domain to refer is a symlink to that redirector:
>
> /www/www.cadenhead.org/html
> is the proper root
>
> /www/redirect_to_cadenhead/html
> contains .htaccess and redirects to the proper root
>
> /www/cadenhead.org
> symlinks to redirect_to_cadenhead
>
> /www/prefect.com
> symlinks to redirect_to_cadenhead
>
> /www/www.prefect.com
> symlinks to redirect_to_cadenhead
>
> I've tried more complex mod_rewrite tricks in the past, but
> I always end up hosing them at some point.
A year or so ago I rented a server on The Planet, based on your
recommendation, and I'm currently reconfiguring it after having
the OS (FreeBSD 4.10) reinstalled. The reconfiguration involves
several domains and virtual hosting, and I want to take advantage
of your PageRank maximizing ideas.
Questions:
(1) Is the .htaccess file mentioned in your comment reprinted above
the file that would contain the lines mentioned in the main post?:
> RewriteEngine on
> RewriteRule ^(.*) www.mydd.com$1 [R=301]
Can these lines be put in httpd.conf, or is .htaccess better?
(2) Is the two-step redirection via symlinks just so you can have
one .htaccess to maintain, despite having three domains you
want to redirect? Could you have just put the .htaccess in the
cadenhead.org directory if you had a simpler situation?
(3) Why is the "/html" in the paths for your document roots? Is
that the directory where your "index.html" and othe HTML files
go? Why not put those files directly in www.cadenhead.org?
Or rather, what _do_ you put directly in www.cadenhead.org?
Yeah, we've experiences a similar issue with our site - http://www.milanclothing.com in that there are a different number of results for the www and non www address in the google SRP (Its all documented in my weblog at http://mykeblack.blogspot.com if you're interested)
Basically I added a 301 redirection in the code as follows:
serverurl = request.ServerVariables("HTTP_HOST")
scriptName = request.ServerVariables("SCRIPT_NAME")
qstringCount = request.QueryString.Count
qs = ""
qscount = 0
For Each Item In Request.querystring
if qscount = 0 then qs = qs & "?" else qs = qs & "&"
qs = qs & item & "=" & request.QueryString(item)
qscount = qscount+1
Next
if serverurl "localhost" and serverurl "www.milanclothing.com" then
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://www.milanclothing.com" & scriptName & qs
else
Response.AddHeader "pragma", "no-cache"
Response.AddHeader "cache-control","private, no-cache, must-revalidate"
Response.CacheControl = "no-cache"
Response.Expires = -1
session.LCID = 2057
end if
Which not only redirects non www pages, but also preserves the querystring, and also adds some cache busting code as a little extra. I think this chunk of code would be handy for any asp users that happen across your interesting article.
I followed Ray's tip, www.cadenhead.org
as amended in 9435, on foodnsport.com.
It looks like there is rewriting if one enters just foodnsport.com, but if there is anything more in the URL, it is not rewriting. Is there any way to get rewriting of any foodnsport.com URL to the www. form?
Thanks,
Ken
It looks like Google has likely figured this issue out...when I ask for allinurl:foodnsport.com
I get back www.foodnsport.com as #1
Does this mean that this is a closed issue?
Ken
I
Raz,
Thanks. Do you mean 'aye' :)
Ken
The site: operator is still broken.
What about off domain 301 redirects. How will they affect a sites PR. Will Google rank the new target (which is a new site) immediately as the old site? Any experience?
What can cause the PR difference between www.abfx.com and www.abfx.com/ and how can it (or should it) be fixed?
I am going through this situation at the moment.
My htaccess is this:
RewriteCond %{HTTP_HOST} ^petngarden.com$ [NC]
RewriteRule ^(.*)$ www.petngarden.com$1 [R=301,L]
I hope my website www.petandgarden.com gets my page rankings back soon.<>
Hello everybody!
this place looks like the right one to ask for help! :-)
i'm hosting a site and planning to install analytics code, but i have
to solve a problem first.
Since we have 7 different domain names pointing to the site, i know i
should add virtual hosts in apache configuration file, redirecting to
the first one with the "permanently moved" code.
The problem is i have apache2 listening on port 80, but the site is
running on tomcat on 8080 . The apache configuration file apache2.conf
is empty and pointing at the conf file in sites-available , which
actually contains the virtual host parameters, looking exactly like
this:
DocumentRoot "/my/path/to/root"
ServerName www.domain.info
ErrorLog /srv/www/vhosts/application/log/error_log
CustomLog /srv/www/vhosts/application/log/access_log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
# Use Apache Proxy to mount the webapp
ProxyPass /application localhost:8080
ProxyPassReverse /application localhost:8080
Options IncludesNOEXEC SymLinksIfOwnerMatch
AddHandler server-parsed .html
Order allow,deny
Allow from all
# Redirect requests for homepage to the welcome action
RewriteEngine On
RewriteRule ^$ /application/ [R]
# Possible values include: debug, info, notice, warn, error,
crit,
# alert, emerg.
LogLevel warn
Do you think adding a VirtualHost looking like the following to
this .conf file, nothing more nothing less would work?
ServerAlias www.domain.it www.domain.it www.domain.eu www.otherdom.com
RewriteEngine on
RewriteRule ^(.*) http://www.domain.info$1 [R=301]
Any help will be greatly appreciated!!
Thanks bye!
Hello,
A question to the group from a "non-techy" user. I own a USPS practice postal exam website that is located at www.aceyourpostalexam.com. My question is this: If I point a second domain name, postalexams.biz to this same site, keeping both domain names will this negatively effect my natural google search ranking?
Greg
After 2 months of very low ranking Google now is giving me back my previous hits per day (600) and I hope they increase now otherwise the whole setup on www.petngarden.com would have been in vain.
However i believe it will be better- will keep you guys informed :)
does this htaccess can be done to blogger..anything that can change the PR in blogger?
http your lookin at it..myspace.com tinnmanb12http your lookin at it..myspace.com tinnmanb12
Thank you very much for make this blog a very good spot of knowledge source, I appreciat the information on the Domain and subdomain , it have been some thing I ws look forward to learn more about!
All comments are moderated before publication. These HTML tags are permitted: <p>, <b>, <i>, <a>, and <blockquote>. This site is protected by reCAPTCHA (for which the Google Privacy Policy and Terms of Service apply).