Home » Magento23 February 2015

Magento: Check & Get Secure URL

Here are the code snippets to check for different secure URLs in Magento.

Secure URL can be enabled from configuration settings (System -> Configuration -> GENERAL -> Web -> Secure).

Enable Secure URL in Frontend

System -> Configuration -> GENERAL -> Web -> Secure -> Use Secure URLs in Frontend = Yes

Enable Secure URL in Admin

System -> Configuration -> GENERAL -> Web -> Secure -> Use Secure URLs in Admin = Yes

Check if Secure URL is enabled in Frontend

Check if Secure URL is enabled in Admin

Check if current URL is Secure

Check if current page is Frontend or Admin

The following code displays Base URL. It displays secure URL if secure URL is enabled. Otherwise, it will display unsecure URL.

Similarly, following code will get shopping cart URL. It displays secure URL if secure URL is enabled. Otherwise, it will display unsecure URL.

Hope this helps. Thanks.

Magento

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed