SEO, Page Rank, Hacks and Joomla 1.5 (Update)

This is an update of the SEO, Page Rank, Hacks and Joomla 1.5.

The previous hack works fine, if and only if, the Joomla installation is located on the root directory. But, it fails when it is installed in a directory under the root directory. To solve the problem, regardless of the location of the Joomla installation, the following line on the file head.php under the “libraries/joomla/document/html/renderer” folder

$strHtml .= $tab . '' . htmlspecialchars($document->getTitle()) . '' . $lnEnd;

need to be replaced with the following

// SEO Hack
// create a new instance of the JConfig
$config = new JConfig();
// get the information from the URI
$info = pathinfo ($_SERVER['REQUEST_URI']);
// that the basename is index.php or index.html if using mod_rewrite or just a default
// in which case, the site name will be set to empty string.
if(( $info['basename'] == 'index.php' ) OR ( $info['basename'] == 'index.html' ) OR ( $info['extension'] == '' ) ) $site_name = '';
// or add the site name before the page title
else $site_name = $config->sitename . ' - ';
$strHtml .= $tab . '' . $site_name . htmlspecialchars($document->getTitle()) . '' . $lnEnd;

In the latest Joomla 1.5.9, the head.php was not part of the upgrade. If you use the upgrade package rather than the full package, your SEO hack will not be affected.

It is always a good practice though to create a log of the file you modify to serve as a guide when you upgrade.

4 thoughts on “SEO, Page Rank, Hacks and Joomla 1.5 (Update)

  1. ???? ???? ??? ?????

    Really, It works great 🙂
    Many Thanks,
    Mohamed Kamal Aboelmagd
    ???? ???? ??? ?????

  2. Lucent One

    This does work and works great. Tried it in Joomla 1.5.16 to 1.5.18

    I use SH404SEF for SEO along with Joomla 1.5.18, Then do the above hack in the head.php page as shown and then comment out lines 100 through 113 in your SH404 component located here:
    *comment lines 100-113 as shown below.

    if ($view==’article’ && !empty($layout) && $layout == ‘form’) { // submit new article
    $title[] = $sh_LANG[$shLangIso][‘COM_SH404SEF_CREATE_NEW’];
    if (!empty($sectionid)) {
    $q = ‘SELECT id, title FROM #__sections WHERE id = ‘.$sectionid;
    if (shTranslateUrl($option, $shLangName)) // V 1.2.4.m
    $sectionTitle = $database->loadObject( );
    else $sectionTitle = $database->loadObject( false);
    if ($sectionTitle) {
    $title[] = $sectionTitle->title;

    Lucent One

Comments are closed.