Cloud Service >> Knowledgebase >> WordPress >> How To Change WordPress Website Address (URL)?
submit query

Cut Hosting Costs! Submit Query Today!

How To Change WordPress Website Address (URL)?

Updating your WordPress website address is a crucial task when migrating to a new domain, enabling HTTPS, or restructuring your hosting environment. Doing this incorrectly can lead to broken links, inaccessible content, or even downtime. In this blog, we will explore the various methods to change your WordPress website URL and ensure a seamless transition.

What Is a WordPress Website Address (URL)?

A WordPress website URL includes two parts:

WordPress Address (URL): This points to the directory where WordPress installation files are stored.

Site Address (URL): This is the address users enter into their browsers to access your website.

Both need to be updated during migrations, domain changes, or security upgrades like moving from HTTP to HTTPS. Failing to update these URLs properly can cause your site to malfunction or display errors.

Why Would You Need to Change the URL?

Changing your WordPress URL is necessary in scenarios such as:

Domain Migration: Switching to a new domain requires an updated URL to reflect the new address.

Implementing HTTPS: Adding SSL to secure your site mandates replacing http:// with https://.

Site Relocation: Moving your WordPress site to a new hosting provider or server.

Fixing Broken Links: Incorrect URLs after migration can break internal links, leading to poor user experience.

Understanding why a URL change is required helps avoid unnecessary complications and ensures your website remains functional throughout the process.

How to Change the WordPress Website Address (URL)

1. Using the WordPress Dashboard

The easiest way to update your WordPress URL is via the admin dashboard.

Step 1: Log in to your WordPress admin area.

Step 2: Go to Settings > General.

Step 3: Locate the fields for WordPress Address (URL) and Site Address (URL).

Step 4: Update both fields with your new website URL (e.g., https://yournewdomain.com).

Step 5: Save changes by clicking the Save Changes button.

This method is straightforward and ideal for minor URL adjustments. However, it may not address issues like broken internal links.

2. Editing the wp-config.php File

For advanced users, modifying the wp-config.php file offers a more permanent solution.

Step 1: Access your WordPress installation files using FTP or a file manager in your hosting control panel.

Step 2: Locate the wp-config.php file in the root directory of your WordPress installation.

Step 3: Open the file and add the following lines:

define('WP_HOME', 'https://yournewdomain.com');  

define('WP_SITEURL', 'https://yournewdomain.com');  

Step 4: Save the file and upload it back to your server.

This approach hardcodes the new URLs, preventing them from being changed accidentally in the admin dashboard.

3. Updating URLs in the Database

If the WordPress dashboard or wp-config.php file methods do not work, you can update the URLs directly in your database using tools like phpMyAdmin.

Step 1: Log in to your hosting account and open phpMyAdmin.

Step 2: Navigate to the database associated with your WordPress site.

Step 3: Locate the wp_options table and find the siteurl and home rows.

Step 4: Edit these rows to reflect your new website URL.

Step 5: Save the changes and test your site.

Note: Always back up your database before making changes to avoid data loss.

4. Fixing Internal Links Using Plugins

After updating your main URLs, internal links within posts, pages, or media may still point to the old domain. To resolve this, you can use plugins like Better Search Replace or Velvet Blues Update URLs.

These plugins scan your database for old URLs and replace them with the new ones, ensuring consistency across your website.

Common Issues and Troubleshooting

Broken Links: After updating your URL, check your website for broken internal or external links. Tools like Broken Link Checker can simplify this process.

Redirect Errors: Ensure proper 301 redirects are configured in your .htaccess file to redirect users from the old URL to the new one.

Mixed Content Warnings: When enabling HTTPS, update all internal links and resources to use https://. Failure to do so can cause security warnings in browsers.

Conclusion

Changing your WordPress website address is an essential step in maintaining a functional and secure site during migrations or upgrades. Whether you update the URL via the dashboard, wp-config.php file, or database, following the right method ensures minimal disruption. Remember to back up your site before making changes, test all functionality afterward, and resolve any broken links promptly.

Cut Hosting Costs! Submit Query Today!

Grow With Us

Let’s talk about the future, and make it happen!