Home » Magento, Magento 29 May 2016

Magento 2: Check if Current URL & Frontend URL are Secure (https)

This article shows how we can check if current URL and frontend URl are secure (https) or not in Magento 2.

Below is a block class of my custom module (Chapagain_HelloWorld). I have injected object of StoreManagerInterface in the constructor of my module’s block class.

app/code/Chapagain/HelloWorld/Block/HelloWorld.php

See more functions in vendor/magento/module-store/Model/Store.php.

Now, we can use the above function in our template (.phtml) file.

Using Object Manager

Hope this helps. Thanks.

Magento 2

Get New Post by Email

Find me on

FacebookTwitterGoogle+LinkedInRSS Feed
  • ND

    Your all Blog are helpful thanks..