Get Directory Paths and URLs For Magento 1

Get directory paths, base URLs and URLs in static block

Posted on December 2, 2016 in Magento

This post helps you to get URL, directory path, get the module URL.

Get Base URL

Mage::getBaseUrl() => get base url path e.g.
Mage::getBaseUrl('media') => get media url path e.g.
Mage::getBaseUrl('js') => get js url path e.g.
Mage::getBaseUrl('skin') => get skin url path e.g.

Get Current URL


Home URL


Get Module’s Action Url


Get Module’s Action SECURE Url

Mage::getUrl('module/controller/action', array('_secure'=>true));

Get Directory paths

Mage::getBaseDir() => /var/www/html/magento
Mage::getBaseDir('app') => /var/www/html/magento/app
Mage::getBaseDir('media') => /var/www/html/magento/media 
Mage::getBaseDir(‘skin’) => Gives skin directory file path
Mage::getBaseDir(‘var’) => Gives var directory file path
Mage::getBaseDir(‘cache’) => Gives cache directory file path
Mage::getBaseDir(‘log’) => Gives log directory file path

Get URL path in Static Block

{{base url=''}} => get base url
{{skin url='images/skinimage.jpg'}} => get skin URL
{{media url='/mediaimage.jpg'}} => get Media URL
{{store url=''}} => get store URL

comments powered by Disqus