{"id":487,"date":"2024-10-01T11:39:52","date_gmt":"2024-10-01T11:39:52","guid":{"rendered":"https:\/\/pondywebhosting.com\/blog\/?p=487"},"modified":"2024-10-01T11:40:09","modified_gmt":"2024-10-01T11:40:09","slug":"changing-site-url-in-wordpress-database","status":"publish","type":"post","link":"https:\/\/pondywebhosting.com\/blog\/changing-site-url-in-wordpress-database\/","title":{"rendered":"Changing Site URL in WordPress Database"},"content":{"rendered":"\n<p>Changing Site URL in <a href=\"https:\/\/www.squarebrothers.com\/wordpress-hosting-india\/\" rel=\"nofollow noopener\" target=\"_blank\">WordPress<\/a> Database, when migrating a WordPress <a href=\"https:\/\/pondywebhosting.com\/web-hosting\/\">website hosting<\/a> or changing its domain, you often need to update the site\u2019s URL in the database to ensure proper functionality. WordPress stores the <strong>site URL<\/strong> and <strong>home URL<\/strong> in the database, which defines where the site resides and where users should be directed. Failing to update these values can result in broken links, missing assets, or redirect issues. By accessing and editing the correct fields in the database, you can quickly update the URLs and restore smooth site operation<\/p>\n\n\n\n<div class=\"wp-block-rank-math-toc-block\" id=\"rank-math-toc\"><h2>To change the <strong>Site URL<\/strong> in a WordPress database, follow these steps:<\/h2><nav><ul><li class=\"\"><a href=\"#1-access-the-database-via-php-my-admin\">1. Access the Database via phpMyAdmin<\/a><\/li><li class=\"\"><a href=\"#2-locate-the-wp-options-table\">2. Locate the wp_options Table<\/a><\/li><li class=\"\"><a href=\"#3-edit-the-site-url-and-home-url\">3. Changing Site URL in WordPress Database<\/a><\/li><li class=\"\"><a href=\"#4-clear-browser-cache-and-cookies\">4. Clear Browser Cache and Cookies<\/a><\/li><li class=\"\"><a href=\"#5-verify-the-changes\">5. Verify the Changes<\/a><\/li><li class=\"\"><a href=\"#optional-perform-a-search-and-replace\">Optional: Perform a Search-and-Replace<\/a><\/li><\/ul><\/nav><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1-access-the-database-via-php-my-admin\">1. <strong>Access the Database via phpMyAdmin<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Log in to your hosting account&#8217;s <strong>cPanel<\/strong> or hosting dashboard.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"602\" height=\"380\" src=\"http:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-12-193246.png\" alt=\"\" class=\"wp-image-191\" srcset=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-12-193246.png 602w, https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/01\/Screenshot-2024-01-12-193246-300x189.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Go to <strong>phpMyAdmin<\/strong> (or another database management tool).<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"991\" height=\"206\" src=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/image.png\" alt=\"\" class=\"wp-image-488\" srcset=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/image.png 991w, https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/image-300x62.png 300w, https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/image-768x160.png 768w\" sizes=\"auto, (max-width: 991px) 100vw, 991px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Select your WordPress database from the left sidebar.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2-locate-the-wp-options-table\">2. <strong>Locate the <code>wp_options<\/code> Table<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Find the table named <code>wp_options<\/code> in the list of tables (it may be prefixed with something other than <code>wp_<\/code>, such as <code>wp123_options<\/code>).<\/li>\n<\/ul>\n\n\n\n<p><img loading=\"lazy\" decoding=\"async\" title=\"open the options table\" width=\"680\" height=\"227\" data-lazy-srcset=\"https:\/\/www.wpbeginner.com\/wp-content\/uploads\/2023\/04\/open-the-options-table-1.png 680w, https:\/\/www.wpbeginner.com\/wp-content\/uploads\/2023\/04\/open-the-options-table-1-300x100.png 300w\" data-lazy-sizes=\"(max-width: 680px) 100vw, 680px\" data-lazy-src=\"https:\/\/www.wpbeginner.com\/wp-content\/uploads\/2023\/04\/open-the-options-table-1.png\" data-ll-status=\"loaded\" class=\"wp-image-178114 entered lazyloaded\" src=\"https:\/\/www.wpbeginner.com\/wp-content\/uploads\/2023\/04\/open-the-options-table-1.png\" alt=\"Open the options table\"><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click on the <strong>Browse<\/strong> button next to the <code>wp_options<\/code> table.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3-edit-the-site-url-and-home-url\">3. <strong>Changing Site URL in WordPress Database<\/strong><\/h3>\n\n\n\n<p>In the <code>wp_options<\/code> table, look for the following two rows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>siteurl<\/code><\/li>\n\n\n\n<li><code>home<\/code> These values control the base URL of your WordPress site.<\/li>\n\n\n\n<li><strong>Step 1:<\/strong> Look for the row with the <code>option_name<\/code><strong> siteurl<\/strong>.\n<ul class=\"wp-block-list\">\n<li>Click <strong>Edit<\/strong>.<\/li>\n\n\n\n<li>Update the <code>option_value<\/code> field with the new domain name or URL.<\/li>\n\n\n\n<li>Click <strong>Go<\/strong> to save changes.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"264\" src=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/enter-siteurl.png\" alt=\"\" class=\"wp-image-489\" srcset=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/enter-siteurl.png 680w, https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/enter-siteurl-300x116.png 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Step 2:<\/strong> Look for the row with the <code>option_name<\/code><strong> home<\/strong>. for changing site URL in WordPress database\n<ul class=\"wp-block-list\">\n<li>Click <strong>Edit<\/strong>.<\/li>\n\n\n\n<li>Update the <code>option_value<\/code> field with the new domain or URL.<\/li>\n\n\n\n<li>Click <strong>Go<\/strong> to save changes.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"279\" src=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/enter-the-home-field-value.png\" alt=\"Changing Site URL in WordPress Database\" class=\"wp-image-490\" srcset=\"https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/enter-the-home-field-value.png 680w, https:\/\/pondywebhosting.com\/blog\/wp-content\/uploads\/2024\/10\/enter-the-home-field-value-300x123.png 300w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4-clear-browser-cache-and-cookies\">4. <strong>Clear Browser Cache and Cookies<\/strong><\/h3>\n\n\n\n<p>After making these changes, you may need to clear your browser\u2019s cache and cookies to see the changes take effect.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"5-verify-the-changes\">5. <strong>Verify the Changes<\/strong><\/h3>\n\n\n\n<p>After Changing Site URL in WordPress Database, Visit your site and check if it now reflects the new domain or URL. You can also log in to the WordPress dashboard and verify the site address under <strong>Settings<\/strong> > <strong>General<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"optional-perform-a-search-and-replace\">Optional: Perform a Search-and-Replace<\/h3>\n\n\n\n<p>If your content still has old domain references, you can perform a search-and-replace in the database for Changing Site URL in WordPress Database using tools like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Better Search Replace<\/strong> (WordPress plugin)<\/li>\n\n\n\n<li><strong>WP-CLI<\/strong> command line tool (<code>wp search-replace<\/code>)<\/li>\n<\/ul>\n\n\n\n<p>This ensures all URLs, including media links, are updated to the new domain.<\/p>\n\n\n\n<p>When Changing Site URL in WordPress Database, it&#8217;s important to take certain precautions to avoid breaking your site or losing data. Here are some key precautions:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Backup the Database<br>Before Changing Site URL in WordPress Database, always take a full backup of your database. You can use plugins like UpdraftPlus or perform a manual backup via phpMyAdmin. This ensures you can restore the site if anything goes wrong.<\/li>\n\n\n\n<li>Check for Hardcoded URLs<br>Some themes or plugins might have hardcoded URLs pointing to the old domain. Before changing the URL, perform a search within your theme and plugin files to check for hardcoded URLs and update them accordingly.<\/li>\n\n\n\n<li>Disable Caching Plugins<br>If you&#8217;re using caching plugins like W3 Total Cache or WP Super Cache, clear the cache and temporarily disable the plugin. This ensures that you don\u2019t encounter cached redirects or old settings.<\/li>\n\n\n\n<li>Verify the Correct Database<br>Ensure you&#8217;re editing the right WordPress database, especially if your server hosts multiple sites or databases. Check the wp-config.php file to confirm the correct database.<\/li>\n\n\n\n<li>Update SSL Settings<br>If you&#8217;re moving from http to https, make sure to install and update the SSL certificates correctly and adjust the WordPress site URL accordingly to use https:\/\/.<\/li>\n\n\n\n<li>Clear Browser and DNS Cache<br>After making changes, clear your browser cache and any DNS cache to ensure you are seeing the updated site.<\/li>\n\n\n\n<li>Update Search Engine Settings<br>After changing the site URL, update your settings in Google Search Console and submit a new sitemap to ensure search engines index the new domain properly.<\/li>\n\n\n\n<li>Use Search and Replace<br>Run a search-and-replace on your database to update all occurrences of the old domain. Use a safe tool like Better Search Replace to ensure all internal links, media, and settings point to the new URL.<\/li>\n\n\n\n<li>Test Thoroughly<br>After the change, check multiple pages of the site, both on the front-end and back-end, to ensure that all functionalities are working as expected, and no old URLs remain.<br>By following these precautions, you can prevent potential downtime, data loss, or configuration issues during the URL change process in WordPress.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Changing Site URL in WordPress Database, when migrating a WordPress website hosting or changing its domain, you often need to update the site\u2019s URL in the database to ensure proper&hellip;<\/p>\n","protected":false},"author":4,"featured_media":493,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54],"tags":[66],"class_list":["post-487","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-changing-site-url-in-wordpress-database"],"_links":{"self":[{"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/comments?post=487"}],"version-history":[{"count":2,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/487\/revisions"}],"predecessor-version":[{"id":492,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/posts\/487\/revisions\/492"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/media\/493"}],"wp:attachment":[{"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/media?parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/categories?post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pondywebhosting.com\/blog\/wp-json\/wp\/v2\/tags?post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}