How to Change Your WordPress Site URL
To change your WordPress site URL, open Settings → General, enter the new address in both WordPress Address (URL) and Site Address (URL), and save. If you are locked out, set WP_HOME and WP_SITEURL in wp-config.php or edit siteurl and home in wp_options. Then run a search-replace for old links, clear caches and add 301 redirects.
For WordPress owners moving to a new domain, switching to HTTPS or recovering a site that broke after a URL change.
knowledge
- Read time
- 4 min
- Sections
- 6
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026.
Which two URLs does WordPress store?
WordPress stores two addresses: WordPress Address (siteurl), where the core files live, and Site Address (home), the address visitors type. On most installs they are identical, start with https:// and have no trailing slash. Both live as rows in the wp_options table and can be overridden from wp-config.php.
This guide is for self-hosted WordPress.org sites. A WordPress.com site changes its address from the WordPress.com dashboard instead. Back up files and database before any method below; a typo can lock you out, and the backup is your undo.
| Method | Needs | Best when |
|---|---|---|
| Settings → General | Working admin login | Planned move, dashboard reachable |
wp-config.php constants | File Manager or SFTP | Locked out after a bad URL |
| WP-CLI | SSH | Fastest, also rewrites content links |
| phpMyAdmin | Database access | No SSH, constants not wanted |
RELOCATE constant | File access, one login | Emergency recovery on a single site |
Method 1: change the URL in Settings → General
Enter the new address in both WordPress Address (URL) and Site Address (URL), save, and log in again at the new address.
- Open Settings → General.
- Type the new URL in both fields exactly, for example
https://www.example.in, with no trailing slash. - Click Save Changes; you are logged out because the admin now lives at the new address.
- Log in at
https://www.example.in/wp-login.phpand open a few pages in a private window.
If the fields are greyed out, WP_HOME and WP_SITEURL are already defined in wp-config.php; edit them there instead.
Method 2: set WP_HOME and WP_SITEURL in wp-config.php
When the dashboard is unreachable, add two constants above the line /* That's all, stop editing! */; they override the database values on every page load.
define( 'WP_HOME', 'https://www.example.in' );
define( 'WP_SITEURL', 'https://www.example.in' );
The site responds at the new address immediately. While the lines exist, the two General settings fields are locked. To make the change permanent in the database, save Settings → General once, then remove the constants if you prefer to manage the URL from the dashboard.
For a one-time rescue, WordPress also supports define( 'RELOCATE', true );: visit /wp-login.php at the address you want, log in, and WordPress updates siteurl to that address; then set Site Address in Settings → General if it also changed. Remove the line straight afterwards, and do not use it on Multisite.
Method 3: WP-CLI, which also fixes links inside content
Over SSH, WP-CLI updates both options and then rewrites every old URL saved in posts, menus and settings, handling serialized data safely. Run it from the folder that contains wp-config.php.
wp option update home 'https://www.example.in'
wp option update siteurl 'https://www.example.in'
# preview first, then run for real
wp search-replace 'https://old-domain.com' 'https://www.example.in' --skip-columns=guid --dry-run
wp search-replace 'https://old-domain.com' 'https://www.example.in' --skip-columns=guid
wp cache flush
wp rewrite flush
Keep --skip-columns=guid: post GUIDs identify entries to feed readers and should not change. Without SSH, the free Better Search Replace plugin performs the same serialized-safe replacement from Tools → Better Search Replace.
Method 4: edit siteurl and home in phpMyAdmin
In phpMyAdmin, open the site's database, find the options table and change the option_value of the siteurl and home rows. The table prefix may not be wp_; check $table_prefix in wp-config.php.
UPDATE wp_options
SET option_value = 'https://www.example.in'
WHERE option_name IN ('siteurl', 'home');
Use SQL only for these two rows. A blanket REPLACE() across all tables breaks serialized widget and theme settings, which store string lengths alongside values; use WP-CLI or Better Search Replace for content. Export the database first, as shown in exporting a database from phpMyAdmin, and see the WordPress database explained for where each value lives.
After the URL change: media, caches and mixed content
Changing the two addresses does not rewrite links already saved in content, so images and internal links break until you run a search-replace and clear every cache.
- Content links: run the search-replace from Method 3 for the old domain and, if relevant, the old
http://version. - Menus and widgets: check custom links in Appearance → Menus and text widgets.
- Caches: clear the caching plugin, server cache and any CDN; clearing the WordPress cache lists each layer.
- Mixed content: if the padlock shows a warning after moving to HTTPS, an asset still loads over
http://; moving from HTTP to HTTPS covers the fix. - Permalinks: re-save Settings → Permalinks once so rewrite rules regenerate.
Redirecting the old WordPress URL with 301s
When the domain changes, every old URL should return a 301 redirect to the same path on the new domain, so visitors, backlinks and search engines follow. Keep the old domain registered and pointed at the server, then add this to the old site's .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?old-domain\.com$ [NC]
RewriteRule ^(.*)$ https://www.example.in/$1 [R=301,L]
Then submit the new sitemap and use the Change of Address tool in Google Search Console (it needs both domains verified). More redirect patterns are in .htaccess 301 redirects, and the wider business side of a rebrand is in changing a website's domain name. On WebJi® WordPress hosting, you can email support@webji.services the old and new addresses and support can run the WP-CLI steps during the move.
Frequently asked questions
Why am I stuck in a redirect loop after changing the URL?
Usually the two addresses disagree with how the site is served, such as https in WordPress while a proxy sends http, or www in one field and not the other. Set both values identically with the constants in Method 2, clear cookies and caches, then test again.
Should WordPress Address and Site Address ever be different?
Only when WordPress core sits in a subfolder, for example files in /wp/ while visitors use the root domain. Then siteurl is https://example.in/wp and home is https://example.in, and index.php in the root loads core from the subfolder.
How do I change the URL of a WordPress Multisite network?
Multisite stores addresses in extra tables (wp_site, wp_blogs, wp_sitemeta) and in DOMAIN_CURRENT_SITE in wp-config.php. Use wp search-replace with --network and update those values; the RELOCATE method does not work there. See the Multisite guide.
Will changing my WordPress URL affect Google rankings?
A change of domain causes a period of re-crawling, during which traffic can dip. Page-to-page 301 redirects, an updated sitemap and the Search Console Change of Address request let Google transfer signals to the new URLs. Changing only from HTTP to HTTPS on the same domain is routine.
Checked 14 November 2026 against the WordPress "Changing the Site URL" documentation and WP-CLI reference · Reviewed by the WebJi® team, Jaipur.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.