Magento : Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url.

Get Url in phtml files

TO Retrieve URL path in PHTML

Note: In editing PHTML don’t forget to change the following code with PHP tag

(a) Unsecure Skin Url :


(b) Secure Skin Url :

$this->getSkinUrl('images/imagename.gif', array('_secure'=>true));

1. Get Magento Base Url :


2. Get Magento Skin Url :


3. Get Magento Media Url:


4. Get Magento Js Url:


5. Get Magento Store Url:


6. Get Magento Current Url:


Get Url in cms pages or static blocks

1. Get  magento Base Url :

{{store url=""}}

2. Get magento Skin Url :

{{skin url='images/imagename.jpg'}}

3. Get magento Media Url :

{{media url='/imagename.jpg'}}

4. Get magento Store Url :

{{store url='mypage.html'}}

3 thoughts on “Magento : Get Base Url , Skin Url , Media Url , Js Url , Store Url and Current Url.

  1. $currentUrl = Mage::helper(‘core/url’)->getCurrentUrl()
    $currentUrl = Mage::getUrl(‘*/*/*’, array(‘_current’ => true));
    above code may not work always as expected.
    Better way to find the current url is to use the following code:

    if (!in_array(Mage::app()->getFrontController()->getAction()->getFullActionName(), array(‘cms_index_noRoute’, ‘cms_index_defaultNoRoute’))) {
    $currentUrl = Mage::helper(‘core/url’)->getCurrentUrl();

Leave your comments

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s