Find Magento's Base URL

When switching between test websites on subdomains to a live domain, placing absolute URLs in Magento's code can cause many pains later. If you forget where you have created a custom link to a page and later move your site, you will run into 404 errors for missing pages. Luckily, Magento has its own PHP code for for finding the base URL you configured in Magento admin.

Keep this simple yet important line of PHP code handy when typing in your custom URLs. For example if you just want to reference the homepage, use:

If you want to create a link referencing a file you have added, just place this

Go to File

If you want to get directly to the source URL of an image, javascript or any file, do the same as above just with one of these different URL types.

And good luck.

Add comment

Security code


Visit Betfair Review