getBaseUrl – Magento URL Path

When developing in Magento and playing arround with Magento Themes there is some functions you should know.

If you want to get the source url of an image, javascript or file, call one of this functions adding your own path at the end.

Under every function there is an example of the output value:


5 Responses to “getBaseUrl – Magento URL Path”

  1. Eric December 14, 2011 at 4:59 pm #

    Rick, great site and resource.

    Wondering if there is a source URL for Magento categories?
    Example: [code]<?php echo $this->getCategoryUrl($_category)?>[/code]

    My site is giving certain visitors an SSL Certificate error. Found that not all my links are converting to the secure https link. My host has verified the certificate placement. Your functions above have helped with converting most of my links to https.


    • Rick December 14, 2011 at 5:47 pm #

      Hi Eric,

      Thanks !

      Try this:

      <?php echo Mage::getModel("catalog/category")->load(5)->getUrl() ?>

      Let me know if it works 😉

  2. mahesh March 29, 2012 at 12:02 pm #

    Is there any method get the URL link for subsites/subdirectories



    • Rick March 29, 2012 at 12:14 pm #

      Have you tried to use the method above? I think it’s smart enough to know if you’re in the store1 or store2.

      Let me know if it works,


  3. Pablo Gancharov March 30, 2013 at 3:26 pm #


    No it isn’t.
    you should use:

Leave a Reply

Add <code> Some Code </code> by using this tags.