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';
Thank You
Problem solved? Click Kudos and "Accept as Solution"
Pleased to see your issue as I think I have the same problem, I am also confused and in need of light on this same issue. Need help.
hanks for sharing, I found a lot of interesting information here tescoviews.
Method 2
ATTENTION: Only use this method if you are familiar with the command line and MySQL queries.
ATTENTION: Angled brackets (<>) indicate placeholder information. Replace the brackets and everything between them with the indicated information milestoneapply.
mysql -u <$database_user> -p <$database_name>
use <database_name>
select * from core_config_data where path like '%base%url%';
update core_config_data set value = 'http://domainname/' where path = 'web/unsecure/base_url'; update core_config_data set value = 'http://domainname/' where path = 'web/secure/base_url';
Pleased to see your issue as I think I have the same problem, I am also confused and in need of light on this same issue. Need help.