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).

7 REPLIES 7

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.

From the main menu, select Stores > Configuration.
  1. On the upper right, click System >Configuration.
  2. From the main menu, under the General list, click Web.
  3. Open the Unsecure and Secure drop-down lists, locate the base URL line, and replace this with the new URL.
  4. Clear the Magento cache and your browser's cache.

Method 2

Method 3: Command line

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.

  1. Use SSH to log in to the server hosting the Magento installation's database.

  2. Enter the following command :
    mysql -u <$database_user> -p <$database_name>
  3. Enter your password when prompted.

  4. Access their database using the following command:
    use <database_name>
  5. Execute:
    select * from core_config_data where path like '%base%url%';
  6. This will display the current base_urls set in Magento.

  7. To change the base URLs, execute:
    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';

 

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.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mcdonalds survey code