Magento - Retrieving Base URL Path

Anyone needing to retrieve the base URL path from Magento, just place this one line of code and there you have it! Hope this helps someone.

<?php echo Mage::getBaseUrl(); ?>

13 comments for Magento - Retrieving Base URL Path

software developer's picture

Humm... interesting, thanx...

Humm... interesting,

thanx for the help.. nice sharing...

Keep up the good work

Kat's picture

Helpful :-) thanks...

Helpful Smile
thanks

Richard Castera's picture

Kat, Thanks!...

Kat, Thanks!

Ben Frain's picture

Thanks Richard, this one had...

Thanks Richard, this one had been driving me nuts! Tried all sorts of PHP lines so glad to finally stumble on this. Cheers for sharing. Ben

thewhiz's picture

Thanks!! Saved me a lot of...

Thanks!! Saved me a lot of time

Prashant's picture

Nice Thanks it helped me!!...

Nice Thanks it helped me!!

Neeraj's picture

Hey, I did the same. But it...

Hey,

I did the same. But it Shows a Fatal Error.
Please Help.

syntax3rror's picture

It simple but hard to...

It simple but hard to find.

Nice post. It really helpful.

Ted's picture

Perfect! thanks....

Perfect! thanks.

Daniel Due's picture

Thanks man.. just what I was...

Thanks man.. just what I was looking for!

Could be nice to get a small collctions going with all the useful tags, i magento!

Anonymous's picture

Thanks, works like a charm!...

Thanks, works like a charm!

Tim's picture

This was exactly what I was...

This was exactly what I was looking for, and about as concise as one can get! If only all Magento documentation were this useful.

Mikal's picture

You gave me some good...

You gave me some good information about the URL path
You are so awesome for helping me.

Post new comment

The content of this field is kept private and will not be shown publicly. If you have a Gravatar account associated with the e-mail address you provide, it will be used to display your avatar.
Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.