Getting the Secure (HTTPS) url for Magento

Hold on Cowboy

This blog post is pretty old. Be careful with the information you find in here. It's likely dead, dying, or wildly inaccurate.

Say you want to redirect a customer to a URL. In Magento you’d invoke this little bit of code to produce the URL. Mage::getUrl(’//post’)

This will produce a url like http://www.example.com/<module>/<controller>/post. The ‘*’ just inserts the current module and controller.

Now you want to redirect to the secure version. Easy. Just simply say so

Mage::getUrl(’//post’, array(’_secure’=>true))

Now that was simple.

Did this help you out? It took me a few days to piece together all this information together, I hope this saves you some time (who knows, maybe the future me will be thankful I wrote this down). Let me know your thoughts. shanestillwell@gmail.com