Forum Moderators: Robert Charlton & goodroi
I have a couple things I would like to clarify on 301's via this example:
A site currently has no redirect - google sees both widgets.com (PR 7) and www.widgets.com (PR 6).
It seems like this site should do a 301 redirect to widgets.com (the higher PR ranking).
Here are my questions:
1) Might this give the site an overall boost in PR?
2) What is the short-term effect of making this change (could it change your rankings and for how long)?
3) Is www. better than non-www?
Also, if you recently made this change yourself - how did it go? Thanks for your help!
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]
ErrorDocument 400 /errordocs/400.php
ErrorDocument 401 /errordocs/401.php
ErrorDocument 403 /errordocs/403.php
ErrorDocument 404 /errordocs/404.php
ErrorDocument 500 /errordocs/500.php
ErrorDocument 501 /errordocs/501.php
ErrorDocument 502 /errordocs/502.php
And if i try to go to [mydomain.com...] nothing happens? I just get Internal Server Error, Apache/1.3.27
[edited by: ciml at 7:00 pm (utc) on July 21, 2005]
[edit reason] Space missing from RewriteCond [/edit]
RewriteCond %{HTTP_HOST}space!^www\.MyDomain\.com
HTTP/1.1 301 Moved Permanently
Date: Thu, 21 Jul 2005 18:33:37GMT
Server: Apache/1.3.27 (Unix) mod_ssl/2.8.14 OpenSS
L/0.9.7d PHP/4.3.1-dev
Location: [MyDomain.com...]
Connection: close
Content-Type: text/html; charset=iso-8859-1
Ryan
Catnip, you had the space in yours in what you posted above, I guess you lost the space when you pasted it into your htaccess file.
RewriteCond %{HTTP_HOST} !^www\.mydomain\.com
There is indeed a space between those there, so he must have lost it when he pasted it (or maybe he manually typed it) into his htaccess file. I see what you're saying though since I previewed this post and there is no space where I now marked in blue above. Yet, the spaces do appear in the htaccess lines.
You can see the moderator tag, with date and time, at the bottom of each post (#49, #54, #61).
[edited by: g1smd at 1:28 pm (utc) on July 22, 2005]
Just on this topic. I am trying to redirect an old site over to a new server.
Problem is that the old site has {QUERY_STRING} parameters attached to the end of the main url which is severely interfering with se results.
So the domain [mydomain.com...] in google appears as [mydomain.com?page_id=13537....]
See [google.com.au...] to see what I mean. Should be the first entry. (Actually not sure if allowed to add this. Not a direct link is linked to google - anyway delete if shouldnt have)
I have gotten rid of all the other query string pages and this is the only one left but obviously the main one.
I am confused how to add the query string in the redirect code into .htaccess. When I try through Cpanel it doesnt work - it actually looks like it sends it into a loop.
Just wondered what the actual code would be.
redirect 301 /?page_id=13537 http://www.example.com.au/
and
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}!^www\.example\.com\.au?page_id=13537
RewriteRule (.*) http://www.example.com.au/$1 [R=301,L]
Various other options too, but nothing has worked so far.
RewriteCond %{THE_REQUEST} \?.+\ HTTP/ [NC]
RewriteRule (.*)$ /$1? [R=301,L]
For more information, please see the Apache Forum [webmasterworld.com].
Justin
Before I implemented this I thought I would check some big sites to see what they are doing. Google redirects non-www to www but a server header checker returns the 302 code. Apple also returns the 302 code.
What's up with that?
My hosting company said they can't do a 301 redirect from widgets.com to www.widgets.com but they can disable widgets.com. Would this resolve our duplicate content problem?
Any help is greatly appreciated.
Would this resolve our duplicate content problem?One significant advantage a 301 redirect offers is that the Page Rank associated with the existing links pointing to either version of your domain name will eventually be consolidated into a single PR value. This can provide a nice boost to your PR.
Simply disabling one version will break those links and you will lose the PR associated with that version. And you may lose a considerable number of those links eventually too, if webmasters decide it's easier to delete your link than to correct it...
Why does the non www and www issue affect some but not apparently most high ranking sites? Are people just being neurotic about "split PR" on the urls or do people believe this is effecting their rank? If this were causing duplicate content penalties why does it not affect so many?
I'm also seeing a lot of sites that have the pr split between both the www and non www - some have 6 on each, which seems odd giving that you can only have 10 total.
Are people just being neurotic about "split PR" on the urls or do people believe this is effecting their rank?The key thing to understand is that www.example.com is a sub domain of example.com. Historically, Google has always treated them as two unique domains and sites. So either or both could acquire a PR of up to 10. PR advances on a logrithmic scale so combining the PR from both domain versions could push a PR6 to a PR7, but it's unlikely to push it much higher.
Why does the non www and www issue affect some but not apparently most high ranking sites?
If this were causing duplicate content penalties why does it not affect so many?These questions have been debated to death. Unfortunately, Google is the only source for a definitive answer and they're not sayin' much.
Similar questions have been discussed for a very long time, you can find some history in #11 at [webmasterworld.com...] to get a sense of the scope of the problem although it was first discussed in '01 or early '02 if memory serves. Eventually it became known as the "canonical page" problem. At [webmasterworld.com...] experienced folks were invited to suggest ways to prevent and avoid canonical problems and many of those techniques were subsequently endorsed by GoogleGuy.
Do some reading and perhaps you'll develop your own theories or find your own answers.
1. If we decide to still get rid of the non-www version of our site (we don't have many links to it) will this cause a problem or penalty the next time Google tries to crawl our www site?
2. I noticed on some of our competitors sites, it doesn't look like the non-www version of their site forwards to the www version because the address bar isn't changing. But when you look at the cached version of the non-www page, it is actually the chache of the www page. Any idea how/why this is happening?
Thanks again for your assistance.
decide to still get rid of the non-www versionIf you "get rid of it," your server should return a 404 error code for the non-www version of your domain name. If it does, that version should move to Google's supplemental index, then eventually be dropped from the entire index with no impact to the www version. (If it doesn't return a 404, get a new host!)
when you look at the cached version of the non-www page, it is actually the chache of the www pageHow can you tell? :) Assuming the sites you're looking at are behaving like your own site (no cloaking or redirects), visitors that request EITHER www.yourdomain.com OR yourdomain.com are being served the same page/file. There is only one HTML file, it is simply being accessed using two different addresses/domain names.
because the address bar isn't changingThere are many ways to do redirects and many different reasons for doing them. Some change the address bar and some don't.
Found this and would like to know what it does. Anyone?
----------------------------------------------------
<Files .htaccess>
order allow,deny
deny from all
</Files>
DirectoryIndex index.php index.html index.htm
----------------------------------------------------
IndexIgnore *
<Files .htaccess>
order allow,deny
deny from all
</Files>
This set of directives instructs your server to NOT serve your .htaccess file to surfers.
DirectoryIndex index.php index.html index.htm
This one specifies your default index page. A "domain name only" request will prompt your server to look for index.php, then index.html, then... It will serve the first one it finds.
IndexIgnore *
I've never used this one. The Apache manual says, "The IndexIgnore directive adds to the list of files to hide when listing a directory." I think this is being used to prevent surfers from being able to see a list of the files in your directories. In my experience, the Options directive is most commonly used to do this as in:
Options -Indexes
The Apache directives for V 1.3 are indexed here [httpd.apache.org] and the V 2.0 directives are here [httpd.apache.org].
1. If we decide to still get rid of the non-www version of our site (we don't have many links to it) will this cause a problem or penalty the next time Google tries to crawl our www site?
No, it will not cause a problem or penalty with Google - it will cause a problem for your surfers.
If you disable the domain and serve 404's for everything, anytime a surfer types in your URL and forgets to type www. first, they will also get a 404 - The converse is also true if you disable the www. and a person types that in.
Please, get a new host - I bet there is one listed at the bottom of this page that could help you out for under $10 / month.
Personally, I believe disabling a version of the domain is far from a wise decision... The purpose of a redirect is to use only one domain, but allow people who access the wrong one to be redirected to the right one. If your hosting company cannot do this simple task, why host with them?
Justin