• Magento 2

    magento2 get base url and media url and static url

    magento2 get base url and media url and static url magento2 get base url and media url and static url. Whenever you are working on  magento2 then a lot of times you need to get base URL and media URL and static url. From this blog, you base url, media url, static content url in Magento2.Magento2 basically, use interface [crayon-5c17effb7575d132923714/] And this class have a function  Store()  which is provide store data. After that,  using getBaseUrl() over Store()  you can get base url  and also get Media URL. [crayon-5c17effb75764734805549/] Where $storeManager is the instance of Magento\Store\Model\StoreManagerInterface. If you want to get Base Url without Index.php then click here. For Getting Media Url Use Below code: [crayon-5c17effb75766318181832/] Get Static content Url [crayon-5c17effb75769117726429/] But I…