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.