How to Get Base URL in Magento 2 With or Without Store Code?

Published: Updated:
By: Simon WalkerEditors:
Content Manager
Table of Content

    In Magento 2, you can get the base URL from the admin panel under Stores > Configuration > General > Web. To retrieve it dynamically, Magento provides options to include or exclude the store code based on store settings. You can also access it programmatically through Magento’s store manager or URL interface.
    blog

    This blog was created with FME's SEO-friendly blog