homepage Welcome to WebmasterWorld Guest from 54.161.191.254
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

This 35 message thread spans 2 pages: < < 35 ( 1 [2]     
The <base> element and how to use it effectively
Angonasec




msg:3412781
 3:17 pm on Aug 3, 2007 (gmt 0)

System: The following messages were split from the Metatag Labyrinth thread [webmasterworld.com]


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

to establish the base url of the site.

Our site uses internal a href links like this:

<a href="/page1.htm">

Rather than the full url.

We used to use a base ref on each page that was:

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

But recently decided to specify the exact url of each page in the base ref:

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

So every page has a different base ref url.

Is this okay or will it cause confusion or conflict to some bots?

I did have a look at WebmasterWorld but couldn't get a definite answer.

If it's wrong we'll change it back.

[edited by: encyclo at 11:24 pm (utc) on Aug. 5, 2007]

 

Angonasec




msg:3417634
 6:57 am on Aug 9, 2007 (gmt 0)

In part answer to my own question:

I used W3c's own link checker and it found no broken links, handling the base ref properly, as did another online site-wide link checker, however, I just tried an online site analysis tool at random.
It is on G's first page of results.

And it (falsely) claimed all my internal links were broken.

They work fine, but the analysis tool simply added the internal link to the base ref url thus:

http://www.example.com/mainpage.htm/page.2.htm

Resulting in a 404.

So there's one clear example of a bot getting confused by this. The first one I've noticed.

NB: I use the full page url in the base href and root-relative internal links.

PS: thebear: Using CSS and ditching tables dramatically improved our load times. (Just scored 10 out 10). Also we lifted the page text to the top of the html file so it gets looked at first by the bots.

But I understand what you mean about multiple external css files and overdoing the styling.

You clearly have more confidence in SEs than I do. :)

theBear




msg:3418420
 11:57 pm on Aug 9, 2007 (gmt 0)

Confidence in SE's you must be joking.

However if they get that part totally wrong they would be out of business very quickly.

Besides html element striping is fairly straight forward.

Like I said after many tens of thousands of pages with many links I haven't seen any fallout.

I also would not add to the complexity of what has to be done to determine what that href actually points to.

The other thing is that the bot doesn't do the indexing or ranking.

Lorel




msg:3418568
 4:01 am on Aug 10, 2007 (gmt 0)

I have used full base href on multiple client sites for several years along with full urls in every thing except images. I did this for the purpose of protecting them from scrapers/hijackers and I haven't had a problem since I set it up.

I don't use full urls on images just in case someone puts the page in a frame (even though I have a pop out of frames script on every page) so if the page does manage to get copied the images won't work but the URLS to my site will work.

JAB Creations




msg:3420412
 11:57 pm on Aug 12, 2007 (gmt 0)

I'm not really following the thread but for those who would to minimize changing things between the test and live environments they can feel free to use this PHP script I created. This will allow you to use the base element in conjunction with your scripts and stylesheets from localhost, your/an IP, and your domain name.

Being in a test environment I default to localhost, you could change it to your local IP of course.

The second part matches your domain name (doesn't need to be exactly your domain name).

The third part assumes you're running your local environment but are showing your test work to a friend via your IP address.

Also if you're using HTML instead of XHTML you will want to remove the trailing slash on the second to last line.

Hope some people find this handy! :)

- John

if ($_SERVER['HTTP_HOST'] == "localhost")
{
$path = 'http://localhost/this_projects_path/';
}
else if ($_SERVER['HTTP_HOST'] == "yoursite")
{
$path = 'http://www.yoursite.com/';
}
else
{
$path = 'http://'.$_SERVER['SERVER_ADDR'].'/this_projects_path/';
}

echo '<base href="';
echo $path;
echo '" />' . "\n";


g1smd




msg:3421192
 10:21 pm on Aug 13, 2007 (gmt 0)

Very useful thanks!

This 35 message thread spans 2 pages: < < 35 ( 1 [2]
Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved