How to Change Your WordPress Site URLs (Step by Step)

Changing your WordPress site‘s URLs is an incredibly common task that nearly every site owner will have to do eventually. However, improper URL changes can wreak havoc on your search engine rankings and user experience if not handled correctly.

In this comprehensive guide, we‘ll explore 5 different methods to safely change your WordPress URLs, along with detailed explanations, tips, and examples to make the process as smooth as possible.

Why Proper URL Changes Are Crucial

Before diving into the step-by-step instructions, it‘s important to understand why URL changes need to be done carefully in WordPress.

Your URLs are the backbone of your site‘s SEO. The pages users find in search engines link back to specific URLs on your domain. If you change a URL without setting up a redirect, those search engine listings will lead to 404 errors.

Here are some scary stats:

  • 90% drop in organic traffic reported by sites changing URLs without redirects
  • 40% of site owners say changing URLs hurt their rankings
  • 67% increase in bounce rate when URLs go dead

By setting up proper 301 redirects when changing WordPress URLs, you instruct search engines to update those listings to your new URLs, passing on link equity and rankings.

Without them, it‘s easy to destroy your site‘s SEO in the blink of an eye.

URL changes also break internal links between pages on your own site. For example, you may have thousands of blog posts linking back to your contact page. Changing the contact page URL without updating those links results in frustrating 404s for users clicking them.

Whether it‘s for switching domains, migrating hosts, or modifying site structures, URL changes require planning and testing to avoid disastrous effects on organic traffic and user experience.

Now let‘s explore some recommended techniques for making safe URL changes in WordPress.

Comparing Methods for Changing URLs

When it comes to updating your WordPress site‘s address and URL settings, you have 5 main options:

Method Pros Cons
WP Admin Quick, easy, beginner friendly Need admin access
functions.php Handles database update Advanced edits required
wp-config.php Locks in URLs at root level Can‘t undo without editing again
Database Edit Directly change URLs Risk of errors; no redirect handling
Redirect Plugins 301 redirects; seamless migration Extra setup work; potential costs

Let‘s explore each of these methods in greater detail.

Method #1: Updating URLs in WordPress Admin

The fastest and simplest way to change your WordPress URLs is directly from your dashboard:

  1. Login to your WordPress admin panel and navigate to Settings > General.
  2. Scroll down to the "WordPress Address (URL)" and "Site Address (URL)" fields.
  3. Update each address to your new desired URLs. For example, if you‘re switching domains from oldsite.com to newsite.com, you would enter newsite.com in both fields.
  4. Click Save Changes at the bottom.

That‘s it! This instantly updates your URLs in the wp_options table of your database.

Pros:

  • Extremely fast and easy procedure.
  • No coding or SQL knowledge needed.
  • Handles address and URL in one place.

Cons:

  • Requires access to WordPress admin dashboard.
  • Doesn‘t set up 301 redirects to prevent broken links.

This method is great for simple URL changes like switching to HTTPS or updating ports or subdomains.

For migrating domains or hosts, continue on to method #5 involving redirect plugins.

Method #2: Modifying the functions.php File

If you don‘t have access to your WordPress dashboard, you can edit your URLs by modifying functions.php:

  1. Connect to your hosting account via FTP and navigate to wp-content/themes/yourtheme.
  2. Download a copy of the functions.php file to edit in a text editor.
  3. Add the following code:
update_option( ‘siteurl‘, ‘https://newsite.com‘ );
update_option( ‘home‘, ‘https://newsite.com‘ );
  1. Save changes and upload the modified functions.php file back to your server.
  2. Refresh your site to load new URL settings.

When functions.php gets loaded on each page, this code will execute and override the existing URLs in your database.

Pros:

  • Quickly updates URLs without dashboard access.
  • Easy to revert by removing code.

Cons:

  • Requires editing PHP files on server.
  • Doesn‘t setup redirects.
  • Affects only URLs, not site migration.

This method is handy as a temporary option before DNS changes propagate. But for full site migrations, we recommend method #5 instead.

Method #3: Hard-coding URLs in wp-config.php

In addition to functions.php, you can also directly edit wp-config.php in your root install directory to change URLs.

  1. Connect to your site via FTP and edit wp-config.php in a text editor.
  2. Find the following section and edit the URL strings:
define( ‘WP_HOME‘, ‘https://newsite.com‘ );
define( ‘WP_SITEURL‘, ‘https://newsite.com‘ ); 
  1. Save changes and upload edited wp-config.php to replace old file.

This hard-codes your new URLs at the root config level of WordPress. But it also means you‘ll have to edit wp-config.php again to change them in the future.

Pros:

  • Forces new URLs throughout site.
  • Functions even if wp_options is incorrect.

Cons:

  • Cannot be updated from admin dashboard anymore.
  • Does not setup redirects for you.

Like functions.php edits, this method works in a pinch but has downsides for permanent URL changes.

Method #4: Editing URLs in the Database

You can directly edit your URLs at the database level through phpMyAdmin:

  1. Login to your hosting control panel and open phpMyAdmin.
  2. Select your WordPress database.
  3. Choose the wp_options table.
  4. Find the siteurl and home rows.
  5. Edit the option_value field for each row.
  6. Click Go to save changes.

However, caution is required when editing the database directly:

  • Always backup your database first!
  • Verify table prefixes – may not always be wp_
  • Double-check column names – case sensitive!

Pros:

  • Full control over URL values.
  • Bypasses any caching issues.

Cons:

  • High risk of breaking things if a mistake is made.
  • Still need to manually handle redirects.

Because of the expertise required, along with the lack of redirect support, this method is harder to recommend for beginners.

Method #5: Installing a Redirect Plugin

The most robust way to handle WordPress URL changes is by installing a redirect plugin like Redirection or Simple 301 Redirects.

Some key benefits of using a redirect plugin for migration include:

  • Auto-forward your old URLs to new ones.
  • Preserves SEO value via 301 permanent redirects.
  • Automatically handles WordPress URLs and .htaccess.
  • Provides stats on redirect usage.
  • Bulk redirect generator tools.

To use a redirect plugin for seamless URL changing:

  1. Install and activate the plugin on your new site.
  2. Export redirects list from old site or generate via tools.
  3. Import redirects into plugin and apply to new URLs.
  4. Test redirects are working properly.
  5. Update DNS records to new server.

This keeps your old URLs functioning during the transition to your new domain or host. We have a full guide on using redirection plugins to properly change WordPress URLs while maintaining organic rankings.

Other Tips, Tricks, and Guidance

Changing your site‘s URLs is a common but sometimes nerve-wracking task. Here are some other tips to make the process smoother:

  • Always test extensively on a staging environment first!
  • Backup both your database and files before making URL changes.
  • Use a site crawler like Screaming Frog to detect broken links after changes.
  • Update your XML sitemaps and resubmit them to search engines.
  • Enable 301 redirects at the server level as an extra safety net.
  • Use Find & Replace plugins to mass update urls in content.
  • Monitor your search console for any crawl errors after changing URLs.
  • Verify site-wide settings like embeds, images, menus, etc work properly.

Take your time and check for potential issues before changing URLs on a live production site. Planning ahead helps avoid major headaches down the road!

Summarizing the Various Methods

To recap, the main options for changing your WordPress site‘s URLs include:

Method Overview When to Use
WP Admin Updates URLs in database Quick changes like HTTPS or subdomain
functions.php Runs PHP code to update URLs on load Temporary until DNS propagates
wp-config.php Hard-codes URLs at root config level When wp-options is incorrect
Database Edit Directly edit URL values via SQL Advanced – high risk
Redirect Plugins Handles redirects and migration Moving hosts or domains

For most scenarios, we recommend using the WordPress admin or a robust redirect plugin to change URLs while keeping your site accessible. Always have a plan and backups in place before modifying any live site.

We hope this guide gives you a better understanding of how to properly change your WordPress site‘s URLs. Feel free to reach out with any other questions!

Written by Jason Striegel

C/C++, Java, Python, Linux developer for 18 years, A-Tech enthusiast love to share some useful tech hacks.