URL plays an important role, knowingly or unknowingly!
The URL which is associated to your Magneto 2 store might not be given that much importance,
which significantly affects the SEO of your store.
So, bringing changes to the base URL is the only solution for improving the SEO status.
Every Magento 2 store has a base URL. In this blog, I will tell you about the methods to be followed to change
Magento 2 base URL.
There are 2 ways to do the following :
1.Using CLI Command
2.Using Table
You can use this method when you want to change the domain URL.
With the below method, the base URL can be changed easily and all the sub-URLs will be affected with the new base URL.
You can use this method when:
1. You want to develop a staging site
2. You want to change the server setup
3. You want a development site
4. You want to have a subdomain site
5. Simply want to change the domain
In all these cases, follow the below method to change the base URL in Magento 2.
Methods to change Magento 2 Base URL:
Change domain helloworld.com to helloworld.in using any of the below methods:
1. Using CLI command : php bin/magento setup:store-config:set --base-url="https://YourStoreUrl.com/" php bin/magento setup:store-config:set --base-url-secure="https://YourStoreUrl.com/" 2. Using Table : UPDATE core_config_data SET value = 'https://YourStoreUrl.com/' WHERE path IN ('web/secure/base_url', 'web/unsecure/base_url'); UPDATE core_config_data SET value = REPLACE(value, 'https://YourStoreUrl.com/', 'https://localhost:8080/') WHERE path = 'design/head/includes';
That’s it.
Any doubts in the above method can be mailed us. I’d be happy to help you out.
Thank you!