{"id":1056,"date":"2020-06-15T12:18:18","date_gmt":"2020-06-15T12:18:18","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/2020\/06\/15\/magento-2-change-base-url\/"},"modified":"2026-01-30T13:56:27","modified_gmt":"2026-01-30T08:26:27","slug":"magento-2-change-base-url","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/magento-2-change-base-url\/","title":{"rendered":"How to Change Magento 2 Base URL"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Magento 2 store URL may not be paid much attention but it plays an important role in\u00a0<a href=\"https:\/\/meetanshi.com\/magento-2-seo-services\">Magento SEO<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every Magento 2 store has a base URL. In this post, I\u2019ll show the methods to&nbsp;change Magento 2 base URL<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Using CLI Command<\/li>\n\n\n\n<li>Using Table<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">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 redirected with the new base URL.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> You can use this method when:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1. You want to develop a staging site<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2. You want to change the server setup<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3. You want a development site<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">4. You want to have a subdomain site<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">5. Simply want to change the domain<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In all these cases, follow the below method to change the base URL in Magento 2.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Methods to change Magento 2 Base URL:<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Change domain helloworld.com to helloworld.in using any of the below methods:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Using CLI command:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>bin\/magento setup:store-config:set --base-url=\"http:\/\/helloworld.in\/\"\nbin\/magento setup:store-config:set --base-url-secure=\"https:\/\/helloworld.in\/\"<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Using Table:<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>UPDATE core_config_data\nSET value = 'http:\/\/helloworld.in\/' \nWHERE path IN ('web\/secure\/base_url', 'web\/unsecure\/base_url');\n\nUPDATE core_config_data \nSET value = REPLACE(value, 'http:\/\/helloworld.com\/', 'http:\/\/helloworld.in\/') \nWHERE path = 'design\/head\/includes';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That\u2019s it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also, do not forget to share the post with the Magento community via social media.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Thank you.<\/p>\n\n\n<div class=\"meetanshi-cta\">\r\n<div class=\"cta-content-wrapper\">\r\n<span>Magento 2 SEO Services<\/span>\r\n<p>Prevent your competitors taking your traffic. Secure your spot now on search results.<\/p>\r\n<a href=\"https:\/\/meetanshi.com\/magento-2-seo-services\" target=\"_blank\" class=\"btn-primary\">Get a Free SEO Audit<\/a>\r\n<\/div>\r\n<div class=\"cta-image-new\">\r\n<img decoding=\"async\" src=\"https:\/\/meetanshi.com\/blog\/wp-content\/uploads\/2026\/01\/Magento-2-SEO-Services.png\" alt=\"Magento 2 SEO Services\">\r\n<\/div>\r\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Magento 2 store URL may not be paid much attention but it plays an important role in\u00a0Magento SEO. Every Magento 2 store has a base&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-1056","post","type-post","status-publish","format-standard","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1056","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=1056"}],"version-history":[{"count":4,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions"}],"predecessor-version":[{"id":25642,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/1056\/revisions\/25642"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=1056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=1056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=1056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}