Skip to content


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 . '<title>' . htmlspecialchars($document->getTitle()) . '</title>' . $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 . '<title>' . $site_name . htmlspecialchars($document->getTitle()) . '</title>' . $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.

Popularity: 3%

Related Posts

Posted in Joomla, PHP, Scripts.

Tagged with , , , .


2 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Mohamed Kamal Aboelmagd says

    I wish it Works !! ;)

Continuing the Discussion

  1. s.pangonilo.com | Ver Pangonilo : Filipino Engineer » SEO, Page Rank, Hacks and Joomla 1.5 linked to this post on March 10, 2009

    [...] This hack has been updated.Related PostsMarch 10, 2009 — SEO, Page Rank, Hacks and Joomla 1.5 (Update)March 9, 2009 — SEO: [...]



Some HTML is OK

or, reply to this post via trackback.