How to change folders of a WordPress blog
WordPress is highly popular and a very useful framework if you wanted to setup a website in literally 5 minutes. However there is a price for that – as WordPress has got some basic design faults which make it hard to do some things. One of those things that you may encounter troubles – if you moved a server or even shifted your blog to a different folder – the blog will stop working. You may want to use some plugins that do so, but if you changed the folder already – you won’t have access to the blog administration. Reason is, that WordPress is saving the folder location in the database, this is under the “wp_options” table:
Actually, the situation is even worst (and bad practice) since wordpress is saving the URL of each blog post in the database. This is the “wp_posts” table which holds all the posts of your blog:
I will explain how you can resolve this. You basically need to run three steps to solve this issue:
Step 1: change the site URL in wp_options
Enter your phpmysqladmin interface, and manually change the siteurl and the home values to the right one. So for example, if you moved from http://www.mydomain.com/folder1 to http://www.mydomain.com/folder2 – change those values accordingly.
Step 2: change all the blog posts URLs in wp_posts
You will need to run a MYSQL command for that, because it you have lots of posts, you don’t want to change all the URLs manually! Enter the wp-posts table and then click the SQL tab. Enter the following command and press “GO”:
UPDATE wp_posts SET guid = REPLACE(guid, 'www.mydomain.com/folder1', 'www.mydomain.com/folder2')
3. Step 3: update the .htaccess file
You need to update your .htaccess file, either by going directly to your file system and updating it, or by downloading it with FTP and uploading it back to the server. Locate the URL in the .htaccess file and change it to your new folder name:
Now check your site – you should be OK!
If any help or questions – please write me
Cheers
Eran