Is there anyway to define the base url in the php files for magento 2 like we doing in wordpress (wp-config file).
Hello @sathwikadh42c0 ,
You can add base URL in Magento in the following way
If you want to add in app/etc/env.php as this will be your config file here
Then include the following at the top of the file:
$_ENV['CONFIG__DEFAULT__WEB__SECURE__BASE_URL'] = 'http://example.localhost/magento-website-path'; $_ENV['CONFIG__DEFAULT__WEB__UNSECURE__BASE_URL'] = 'http://example.localhost/magento-website-path';
Problem solved? Click Kudos and "Accept as Solution"
I was also having the same problem. Thanks for sharing this information.