Knowledgebase

How to change the link of the header logo in Magento

By default, the logo that's displayed in the header on the frontend of your Magento site is also a link to the homepage of the site. So, for example, if the homepage of the site is yourdomain.com and a visitor/customer clicks on the logo (no matter from what page on your site), they will be redirected to yourdomain.com. If you want to, you can change that link. It can be a link to another page on the same site or it can be an external URL.

You can achieve this by modifying the file header.phtml of the theme that you use. If, for example, you use the base theme that comes prepackaged with Magento and the application is installed directly in the public_html folder on your Magento hosting account, then the path to the file on your account will be public_html/app/design/frontend/base/default/template/page/html/header.phtml. In the file find the code:

<h1 class="logo"><strong><?php echo $this->getLogoAlt() ?></strong>
<a href="<?php echo $this->getUrl('') ?>" 
title="<?php echo $this->getLogoAlt() ?>" class="logo">
<img src="<?php echo $this->getLogoSrc() ?>" 
alt="<?php echo $this->getLogoAlt() ?>" /></a></h1>

In that code you need to edit the part:

<a href="<?php echo $this->getUrl('') ?>"

Delete <?php echo $this->getUrl('') ?> and between the quotation marks type the full URL address. So, for example, if we want the link of the logo to redirect to hostknox.com, the edited part should look like this:

<a href="http://hostknox.com"

After you save the change refresh the frontend of your site and check the result. You can edit the file from the Files section of the Pixie control panel. Another way to do it is to download it on your local computer with an FTP client (e.g. FileZilla), edit it with a text editor (e.g. Notepad, Wordpad) and upload it back overwriting the old file.

If you use a theme different than the base one, you have to look in the respective folder of that theme (e.g. public_html/app/design/frontend/default/name-of-theme/template/page/html/header.phtml). If there's no such path and file for the theme that you use, modify the base file.

If you need information on how to change the image of the logo, check out the article on changing the header logo in Magento.

Was this answer helpful?

 Print this Article

Also Read