Forum Moderators: open

Message Too Old, No Replies

Use or not the "Base" meta tag

Should I use to avoid being indexed without the "www"?

         

fischermx

7:12 pm on May 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




I recently found one of my newer sites got fully indexed by google using the non-www version of it: "example.com".
My site just have a few backlinks and I swear all they are using "www.myexample.com".
So, I don't know why google decided to use the one without the "www".
My question is, if I use the "base" meta tag, can I avoid this kind of problem?
I would thought it is, but in my research I found a post [webmasterworld.com...] which actually tells the opposite: "remove the base" meta tag in order to avoid problems.
What do you think?

rjohara

7:34 pm on May 18, 2005 (gmt 0)

10+ Year Member



I've had BASE elements on all my pages for years and it has caused no problems. It's perfectly good HTML:

[w3.org...]

I don't think the characterization of BASE given in the thread you cite above is correct. This is perfectly acceptable, and is how I do it:

<base href="http://www.example.com" />

with all internal links on each page in the form:

<a href="/mydir/pageone.html">

etc.

encyclo

7:39 pm on May 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to set a 301 permanent redirect from the non-www version to the www version, rather than relying on a
base
tag. This can be done with mod_rewrite if you're running Apache, or with a server-side scripting language (PHP, ASP...).

fischermx

8:35 pm on May 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



rjohara :

Is it correct to close the tag like this />?
<base href="http://www.example.com" />

Would you mind to take a look again at the thread I cited [webmasterworld.com...] There are some new posts :)

rjohara

8:56 pm on May 18, 2005 (gmt 0)

10+ Year Member



There are two different issues here. The first is the syntax of the BASE. I wrote it above as correct XHTML; in HTML you'd just write <base> rather than <base />. See the last two messages here:

[webmasterworld.com...]

The second issue is whether the BASE element helps clarify the www.domain.com vs. domain.com issue. Encyclo is correct that the most thorough way of doing this should be with an .htaccess rewrite directive; experience seems to show that this may take months to register with the search engines. Independent of that, however, using a BASE element and relative URLs will insure that all *internal* linking within your site has the same format (www or non-www, as you please). The BASE element will also insure that visitors will see the chosen form of the URL in their browsers when they mouseover a link, for example; I think that has some benefit. And if you ever move your entire site from one domain or directory to another, you can just search and replace the BASE element and you're done.

So in summary, I have found that using a BASE element, while optional, has some benefits. *Internally* it serves the same function as the htacess rewrite, but it can do nothing about how outside people link to you.

Reid

4:56 am on May 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



fishermx - sorry if that thread caused you some confusion. It is not related however.
In the other thread I was wondering how google indexed /" as a page and was thinking the base href was being misinterpreted.
Turns out that the site owner caused it to happen on his own. (see thread)

.htaccess is the common method to solve www and non www issue. - make sure it's a 301.