cancel
Showing results for 
Search instead for 
Did you mean: 

How to Define the Base url in conf file for magento 2.

How to Define the Base url in conf file for magento 2.

Is there anyway to define the base url in the php files for magento 2 like we doing in wordpress (wp-config file).

6 REPLIES 6

Re: How to Define the Base url in conf file for magento 2.

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" 

Re: How to Define the Base url in conf file for magento 2.

I was also having the same problem. Thanks for sharing this information.

 

 

Re: How to Define the Base url in conf file for magento 2.

Hello @ut707396gm64da,  @danicadann64f0 ,

 

Glad to know your problem solved ,
Thanks.
Happy coding Smiley Happy


Re: How to Define the Base url in conf file for magento 2.

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.

 

american express confirmcard

Re: How to Define the Base url in conf file for magento 2.

hanks for sharing, I found a lot of interesting information here tescoviews

Re: How to Define the Base url in conf file for magento 2.

very thanks!!!Robot Happy