Skip to content

Workaround for base href issues in Mambo

Most users of Mambo and Joomla would agree that the basic handling of so-called "SEF" (Search Engine Friendly) URL's is really bad. Unfortunately, the SEF code is so deeply entrenched in the core of both CMS's that there is little that can be done about it in the short term. However, if you are experiencing problems with the base href issue, this little trick should help.

In your template's index.php file locate this code within the <head> tags:

<?php mosShowHead(); ?> 

Replace it with this:

<?php mosShowHead('','base'); ?>  

This prevents Mambo from outputting the generated base href tag. If you are using SEF and need to specify a base href you will then need to manually add this to your template's index.php header area to enable correct linking to relative links within your site when you have SEF enabled.

If your site is in the server root (not a directory off the root), use this code within the <head> tags:

<base href="<?php echo $mosConfig_live_site;?>" />

If you have Mambo installed in a directory, then use this instead:

<base href="<?php echo $mosConfig_live_site;?>/" />

If you enjoyed this post, make sure you subscribe to my RSS feed!

Topic: Mambo Tutorials
Tagged as: base href, base href tag, Mambo, PHP, php header, SEF, templates

Share on FriendFeed

{ 0 comments… be the first to comment }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Any comments that look like spam will be treated as spam - this includes SEO titles and use of spurious keywords.

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.