4 Ways to Get Magento Homepage URL

By Avinash

August 03, 2012Web Development1 Comment

Here I comes with one more quick tip for Magento, earlier we have seen tips to detect the pages in Magento. In this article I would like to share 4 ways with which you can get home page URL in Magento.

Among these 4 methods, 3 can be used within the code and 1 method can be useful when you are dealing in admin panel CMS section for Static Blocks.

So let’s don’t waste time and have a look at the code snippets:

Option 1

echo $this->getUrl('');
echo $this->getUrl('');

Option 2

echo Mage::getBaseUrl();
echo Mage::getBaseUrl();

Option 3

echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);

Option 4

This option will be used to get the home page URL in static blocks.

<a href="{{store url=""}}">Link to Homepage URL</a>

If you aware of any other method or ways to get home page URL in Magento then consider sharing to the world by placing the comment, Because Sharing is Caring.

If you don’t want to miss any upcoming article then subscribe to our RSS Feed via mail, Like us on Facebook or Follow us on Twitter. If you do so, I am sure you will never miss any article/freebies or updates from us.

Share This Article

Tags: