Are you seeking an easy way to change your WordPress URL? Fortunately, in today’s blog, we are going to discuss some useful methods to help you easily change your WordPress URL. Now, let’s check them out.
Why do you need to change your WordPress URL?
Sometimes, you will need to change your WordPress URLs in the following scenarios
- Firstly, you completely want to change to a new domain name. Because you realize that your current domain name is not professional. In this case, you need to change your site URLs and move your entire site to the new domain.
- Secondly, you want to move your site from HTTP to HTTPS to improve the security of your site or even boost your site’s ranking
- Thirdly, if you want to move WordPress to a different directory, then you also need to change your site URL. For example, you want to remove /wordpress/ from your WordPress URL.
How to change your WordPress URL?
Method 1: Change the WordPress URL from your WordPress dashboard
This is the easiest way to change your WordPress URL directly from your admin dashboard. Now, you can track the following steps to implement.
Firstly, simply go to Settings >General from your WordPress dashboard.
Then, on the general setting screen, you need to update the two fields below:
- WordPress Address (URL): you need to type the address to reach your website
- Site Address (URL): you need to enter the address of your WordPress core files
You should notice that the addresses of both fields are the same unless you want your site home page to be different from your WordPress installation directory.
Once you are done, let’s click on the “Save Changes” at the bottom of the page.
In case, you enter the mismatched URL or wrong URL, you can still override the settings in the admin screen by modifying your wp-config.php file. We will display this way in the next method.
After updating the new URLs, it is necessary for you to clear your WordPress cache. Or then you might get a redirect error. You might need to see our detailed tutorial on how to clear your cache in WordPress manually.
Method 2: Change WordPress URL via wp-config.php File
This is the second most prevalent method to change your WordPress URL by using the wp-config.php file. By using this method, you need to note that all values in wp-config.php override the settings in your WordPress admin.
To use this way, all you need to do is add your website URLs to your wp-config.php. You can find this file in the root folder of your website.
Firstly, you need to access your website via an FTP client before changing this file. Then, you can locate the wp-config.php file that is found in the root directory of your website.
In your wp-config.php file, you need to add the following code right above the line that displays “That’s all, stop editing! Happy publishing”.
define( 'WP_HOME', 'https://yoursite.com' );
define( 'WP_SITEURL', 'https://yoursite.com' );
Remember to replace https://yoursite.com with your domain name.
Once you are completed, you need to save your wp-config.php file and close it.
Now, you can go back to the General setting screen from your WordPress dashboard, you will notice that those two fields on this page are now grayed out. And you are not able to edit them, except if you remove the two code lines in wp-config.php.
Method 3: Change WordPress site URLs using the functions.php file
This method is suitable for those who are not able to access their WordPress dashboard.
Initially, you need to access your WordPress site by using an FTP client. After connecting to your WordPress site, you need to locate your WordPress theme folder.
Let’s simple click on wp-content > themes> your theme folder.
In your theme folder, you need to open your functions.php file and modify it with the following code at the bottom of the file to change WordPress URL in database.
update_option( 'siteurl', 'https://yoursite.com' );
update_option( 'home', 'https://yoursite.com' );
Similarly, you need to change the URL in our code with your own site URL. Now you can click on the “Save Changes” button and upload the file back to your server via FTP.
One of the pros is that this method helps you update your site URLs in the database. And once your functions.php file is loaded, WordPress will update the database for your site URLs.
Moreover, you can also delete the two lines of code in your WordPress functions.php file if your site is working correctly.
How to create redirect after changing WordPress URL
After you changed your WordPress URL, now you need to redirect your site’s visitors to the new URL to avoid getting 404 errors as well as affecting users’ experience on your site.
To do that, you need to generate a duplicate of your existing site by using one of the best WordPress backup plugins, then move it to a new domain.
After that, you need to create a redirect your old site to your new site.
If you need more support, let’s see our guide on how to create 301 redirects in WordPress to redirect single posts and pages, and much more.
Summary
Those are the most common methods that can help you easily change your WordPress URL. Hopefully, our blog provides you with useful solutions. If you get into any trouble, don’t hesitate to leave a comment below. We are always willing to help you.
Moreover, if have an intention to make the appearance of your website look eye-catching, don’t ignore our Free WordPress Themes that come with a dozen of designs.
- How to place menu items in helix joomla 5 ? - December 14, 2024
- How to reduce the size of helix 2 layout ? - December 14, 2024
- What’s J4 starter template and how to use it - December 3, 2024
Recent Comments