{"id":7854,"date":"2024-04-19T00:08:30","date_gmt":"2024-04-18T18:38:30","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=7854"},"modified":"2024-04-19T00:39:50","modified_gmt":"2024-04-18T19:09:50","slug":"how-to-update-secure-and-unsecure-urls-directly-in-the-magento-database","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/how-to-update-secure-and-unsecure-urls-directly-in-the-magento-database\/","title":{"rendered":"How to update secure and unsecure URLs directly in the Magento database"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Introduction<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Updating secure and unsecure URLs directly in the Magento database can be necessary when you need to modify your website&#8217;s base URLs swiftly and efficiently. This method bypasses the Magento admin panel and allows you to edit the configuration stored in the database directly. It&#8217;s handy when you&#8217;re unable to access the admin panel due to technical issues or when you prefer working directly with the database<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Prerequisites<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A sudo privileged SSH access to the server <\/li>\n\n\n\n<li>Magento DB credentials<\/li>\n\n\n\n<li>The domain name  that we need to update in the DB<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Implementation<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step1: SSH the server<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ ssh Username@IP<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 2: Log in to the MySQL DB with the credentials.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ mysql -u username -p dbname<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 3: Switch the DB associated with the Magento panel<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>&gt; use dbname;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 4: Update the secure URL, execute the below query<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>&gt; UPDATE core_config_data SET value = &#8216;https:\/\/yourdomain.com\/&#8217; WHERE path = &#8216;web\/secure\/base_url&#8217;;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Step 5: Update the unsecure URL, execute the below query<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>&gt; UPDATE core_config_data SET value = &#8216;http:\/\/yourdomain.com\/&#8217; WHERE path = &#8216;web\/unsecure\/base_url&#8217;;<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Note:<br>Replace http:\/\/yourdomain.com\/ and https:\/\/yourdomain.com\/ with the actual unsecure and secure base URLs, respectively.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Step 6: After updating the URLs in the database, it&#8217;s a good practice to clear the Magento cache to ensure that the changes take effect<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><td>$ php bin\/magento cache:flush<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Note:<br>Execute this on the document&#8217;s root<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Updating secure and unsecure URLs directly in the Magento database can be necessary when you need to modify your [&hellip;]<\/p>\n","protected":false},"author":495,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1022],"tags":[969],"class_list":["post-7854","post","type-post","status-publish","format-standard","hentry","category-web-architecture","tag-magento","psol-cat-web-architecture"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-22G","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7854","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/495"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7854"}],"version-history":[{"count":0,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7854\/revisions"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7854"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7854"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7854"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}