How to Change Your WordPress Site’s URL

change wordpress URL

There’s plenty of times you may choose to change your website’s address. Maybe you weren’t happy with the name or you just want a fresh start. If you are having trouble with how to change your URL, HostDime is here to help.

Change the URL in General Settings

Here’s the easiest way to edit the “Wordpress Address” and “Site Address”. To make a change to the URL, log on to your WordPress Admin and go to “General Settings”. Edit the fields called “WordPress Address (URL)” and “Site Address (URL)” to the URL of your choice. Then click “Save Changes” and you should have your new address.

Change the URL through “Update Option”

Another way to change the address is by using the WordPress function “update_option”. Simply add these lines to the functions.php file of your theme:

update_option(‘siteurl’,’http://www.theURLyouwant.com’);
update_option(‘home’,’http://www.theURLyouwant.com’);

“Oh No! I Can’t Log Back In!”

If you typed something wrong by accident, you may not be able to log back into your WordPress site. To fix this, add the code “wp-config.php” to make changes to the URL manually. Open the “wp-config.php” file in your WordPress install via an FTP or SFTP client. Then add the following code:

define(‘WP_HOME’, ‘http://theURLyouwant.com’)
define (‘WP_SITEURL’ ,’http://theURLyouwant.com’);

Once the code is inserted, update the file to your sever and your site should be back to normal. If the code does not work, your “wp-config.php” file is configured as read only.

Save Your Old URL

You may also want to change the URL when developing a new version of your site in a sub-folder and then moving it to your root directory when it’s ready for public viewing. It’s a good idea to keep the original blog rather than deleting it because you can use it as a test blog and a backup. Once a blog is deleted, the URL can not be recycled.

Much of this article first appeared on HostDime Resources. HostDime Resources provides guides, tools, videos, and other knowledge to better help you understand how to use your various web hosting services. If you have any ideas for articles, write us a comment below.

[divider]

HostDime is one of the top 50 web hosts in the world. Follow HostDime on Twitter and Facebook.

Jared S. is HostDime’s Technology Writer. Follow him on Twitter.

2 thoughts on “How to Change Your WordPress Site’s URL

  1. One thing that is forgotten here is the fact that all images, attachments and everything else that is hard coded via the db will need to be updated to the new url.

Leave a Reply

Your email address will not be published. Required fields are marked *