How to get the current URL in Magento
PHP has its own methods to get URLS, but Magento has some wrapper methods that you should really use. Here’s a summary.
Happy Halloween everyone! Here are a few Magento code snippets from my notes.
Get current URL in Magento
$current_url = $this->helper('core/url')->getCurrentUrl();
Get Magento root URL
// base url of magento $base_url = Mage::getBaseUrl();
Get Magento Media Directory
// url of media directory $media_url = Mage::getBaseUrl('media');
Check if Magento URL is secure https
// Is the page https:// ? $isSecure = Mage::app()->getStore()->isCurrentlySecure();
Gareth