URL Canonicalization Lesson
-
darkchanter
- Posts: 4
- Joined: 29 Jun 09
10 Jul 09 8:47 am
I was reading the lesson on the similar title and I (may) have a way to use both:
You can write some javaScript (or PHP, I suppose) to redirect from the one to the other. Let's say the mydomain.com is your SEO site, put the following javascript in the HTML header (above the robots meta tag):
As the lesson/article points out, many people will not bother to type the www, they'll go straight to "mydomain.com"; however folks like me will type "mydomain" in their browser and press crtl+enter (which fills in the "www." and ".com" for one and then browses to the site).
I haven't tested this. Does anyone know if search engine spiders will see this as bad linking?
You can write some javaScript (or PHP, I suppose) to redirect from the one to the other. Let's say the mydomain.com is your SEO site, put the following javascript in the HTML header (above the robots meta tag):
- Code: Select all
<script language="javascript" type="text/javascript">
if(/www\./.exec(window.location.toString)) { document.location="http://mydomain.com"; }
</script>
As the lesson/article points out, many people will not bother to type the www, they'll go straight to "mydomain.com"; however folks like me will type "mydomain" in their browser and press crtl+enter (which fills in the "www." and ".com" for one and then browses to the site).
I haven't tested this. Does anyone know if search engine spiders will see this as bad linking?
Last edited by faradina on 14 Jul 09 10:26 am, edited 1 time in total.
Reason: make title relevant to content
Reason: make title relevant to content
Regards
Darren
Darren
-
faradina
- Posts: 2171
- Joined: 01 Jun 09
- Location: Philippines
10 Jul 09 12:29 pm
The whole point of the URL Canonicalization lesson is about not using both www and non-www web addresses so as not to divide the link juice and affect page rank. It is about getting the most out of your search engine listing and not only about redirecting from the www address to the non-www address or vice-versa. People will still get to your website whether or not they put in the www. Search engines think that the www is different from the non-www address and will only display one version of your site in the search listings.
-
darkchanter
- Posts: 4
- Joined: 29 Jun 09
10 Jul 09 1:31 pm
Hi Faradina,
I'm not sure that I follow you, if "Search engines think that the www is different from the non-www address" then why would they "only display one version of your site in the search listings"?
Let me put a frame around it, so to speak. I agree that one should only market one of the two, let's say "mydomain.com". What my intent is, is that someone may remember the domain name and type in, or link to, "www.mydomain.com"; so if that traffic is "redircted" to mydomain.com, then mydomain.com will (also) get the traffic that arrived at www.mydomain.com.
I'm not sure that I follow you, if "Search engines think that the www is different from the non-www address" then why would they "only display one version of your site in the search listings"?
Let me put a frame around it, so to speak. I agree that one should only market one of the two, let's say "mydomain.com". What my intent is, is that someone may remember the domain name and type in, or link to, "www.mydomain.com"; so if that traffic is "redircted" to mydomain.com, then mydomain.com will (also) get the traffic that arrived at www.mydomain.com.
Regards
Darren
Darren
-
faradina
- Posts: 2171
- Joined: 01 Jun 09
- Location: Philippines
13 Jul 09 10:55 am
Those who type http://www.mydomain.com and those who type mydomain.com will both get to your website. But for search engines, http://www.mydomain.com and mydomain.com are not the same. In searches, people (especially those who do not know of your site, in fact, those who already know of your site would most probably not be searching but go to your website directly ) do not necessarily type in http://www.mydomain.com or mydomain.com. They usually type in queries for whatever they are searching for. If your keywords fit their query terms, your listing will appear, but only one (either domain.com or http://www.domain.com) will be listed in the search results. That's how search engines are. Because search engines think that the www and non-www addresses are different from each other, they treat one as having duplicate content and will not display it in the listing.
-
darkchanter
- Posts: 4
- Joined: 29 Jun 09
13 Jul 09 12:39 pm
Ah, I see - it's the duplicate content rule that I wasn't cognisant of!
Regards
Darren
Darren
