For the regular visitors here, you might have noticed that I have changed this blogs URL from http://personal.ryantdams.com to http://blog.ryantadams.com. Behind the scenes I also moved the actual WordPress files from a folder on my web server named “personal” to a folder named “blog” to better match the new URL. The big problem with changing the URL of my WordPress blog is making sure all the old links (either in my posts, or on external websites) still worked. Here is everything I did to move my blog to a new URL:
First, make a backup of both your database and the actual files in your WordPress folder. If something goes wrong, you’ll want these backups. Just in case you think, “Oh, nothing bad will happen…”, you should know that I had to restore from my backups five times before finally getting everything to work.
- Disable any plug-ins you have that even remotely depend on your blogs URL. For me, this meant disabling “Permalinks Moved Permanently” and “Hotlink Protection” along with several custom plug-ins I had made.
- Navigate to the Administration > Settings > General panel section of your blog.
- In the box for “WordPress address” change the data to your new blog address. BE CAREFUL TO TYPE IT COREECTLY.
- In the box for “Blog address” type your new blog address. Again, BE CAREFUL TO TYPE IT COREECTLY.
- Click “Save Changes” or “Update Options” depending on your version of WordPress.
- You will probably see a 404 error. This is OK. In fact, if you don’t see a 404 error you should be concerned. Just close down your browser and DO NOT attempt to access your blog at either it’s new or old address.
- Connect to your web server (presumably via FTP).
- Navigate to the folder containing your WordPress files, then delete the folder folder “wp-content/cache”.
- If you want to rename the folder your WordPress files are in, do this now.
- This step depends on how you have set up your URL and folders:
- If you are using sub-domains or any form or redirection, log in to your web host’s control panel and be sure that the new URL for your blog (steps 3 & 4) points to the folder with your WordPress files (step 9). For example, I set the sub-domain “blog.ryantadams.com” to point redirect to the folder named “blog” on my web server.
- If you are not using any sort of redirection, make sure the new URL for your blog (steps 3 & 4) accurately directs to the folder with your WordPress files (step 9). For example, if your new URL is “mysite.com/blog/wordpress/” your WordPress files should be in the folder “wordpress” inside of the folder “blog” located in the root of your web server.
- If you are using Permalinks, go to the Administration > Settings > Permalinks panel and click the “Save changes” or “Update Options” button.
- Finally, you will want to make sure that any links in your posts are updated to reflect the new URL. To do this, use PHPMyAdmin (which you should be able to access from your web host’s control panel) to run the following SQL Query:
UPDATE wp_posts SET post_content = REPLACE (
post_content,
'old.mysite.com',
'new.mysite.com');
If you moved your WordPress fiels into a new folder, you will also want to ruin this query:
UPDATE wp_postmeta SET meta_value = REPLACE (
meta_value,
'htdocs/personal',
'htdocs/blog');
Obviously, update the last two lines of each query with your own information. - Now you can enable any of the plug-ins you disabled earlier.
- That should do it. One last thing you will want to do is set up some sort of redirection so that visitors who click links to your old URL will get to your new site.