How to easily change your wordpress url

→ Are you a new visitor? Please visit the page guidance for new visitors ←

How to easily change your wordpress url

I’ve seen a bunch of requests recently on how to change your wordpress url to a new url, probably by changing the domain or moving to a different subfolder. This information is documented on wordpress codex website. It is always there and will be for as long as wordpress will exist.

It is really easy to change the url, simple put you have about 4 options that you can work with.

1. Changing the url from wordpress wp-config.php

This is the most easiest way to change the site url, it consists in only adding 2 lines to your wp-config.php file. Now please do keep in mind, this file contains your mysql conection details, please do not open the files with and word document like office word or wordpad or similar. Please open this file with the simple editor notepad, or the new notepad++, linux users I recommend gedit or kedit or whatever editor you have installed.

The lines you need added are:

Again, this is first and most used option by me, there are also 2 more options to do this.

Heads up! This option does not change your website url in your database, it only hardcodes the links and allow you access to your blog to manually change the site url from your wp-admin/Settings section.

2. Editing the functions file

This is not an option I really recommend, however it is there for those who wish to change the url in one go. Open your theme functions.php file using notepad again and there add:

Load your website once, then remove the above lines from the functions.php file, DO NOT leave them there!

3. Using the relocate method

This is another option provided by wordpress that allows your wordpress to find its own path for it work and for you to be able to login to your admin section. This will only be temporary, you will need to change the website url in your wp-admin/Settings section to the new url.

What you need to do is add the line bellow to your wp-config.php:

You will need to remove the line after you corrected your url in your wp-admin section.

4. Lastly, changing the url in your database, however this is not something I would recommend, but for those who wish to proceed with this method, please follow:

  1. Login to phpMyAdmin.
  2. Click the link to your Databases.
  3. A list of your databases will appear. Choose the one that is your WordPress database.
  4. All the tables in your database will appear on the screen.
  5. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  6. Click on the small icon indicated as Browse.
  7. A screen will open with a list of the fields within the wp_options table.
  8. Under the field option_name, scroll down and look for siteurl.
  9. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  10. The Edit Field window will appear.
  11. In the input box for option_value, carefully change the URL information to the new address.
  12. Verify this is correct and click Go to save the information.
  13. You should be returned to your wp_options table.
  14. Look for the home field in the table and click Edit Field. Note There are several pages of tables inside wp_options. Look for the > symbol to page through them.
  15. In the input box for option_value, carefully change the URL information to the new address.
  16. Verify this is correct and click Go to save the information.


Again, all this information is found directly on wordpress codex website!

Request an article ←