Moving Wordpress to new dir

MyWorld

Executive Member
Joined
Mar 24, 2004
Messages
5,001
Reaction score
6
Location
Wes Transvaal
I have an issue with our current WordPress installation/site, it is installed into a child dir, not the html root, which means I have to use a .htaccess file to redirect traffic to WordPress.

At the time it seemed like a good idea, but now, constantly, for no apparent reason, the .htaccess file gets overwritten resulting in a lot of 403's. It is 644 permission so I have no idea how it happens and the logs are not very helpful either. For now I'm guessing it is a software bug in WordPress, although I cannot confirm this.
It takes a couple of hours for me to notice at a time and then the site is down all that time without me knowing.

I now want to move the WordPress installation to the html root dir, but have never attempted this before and have no idea how the site will hold up if I just simply move the files over and delete the child dir.

Are there any precautions other than backing up the site that I need to take? Any steps to ensure it is painless?
I know I'll have to redo all the hard links, but I assume Wordpress will take care of the blog post and other posts on its own after I changed the settings in WordPress?

Thanks for the help.
 
Well, it was pretty painless.

First off, I'm so glad I used absolute paths in all the links, no need to edit any of the pages, everything is where they are supposed to be.

I just copied over the entire Wordpress install to the html root and update the wp-config file:
Code:
 /** The Database Collate type. Don't change this if in doubt.
*/ define('DB_COLLATE', '');

define('WP_HOME','http://example.com/');
define('WP_SITEURL','http://example.com/');

Done! Nothing to it actually.
 
In the end I ran into one problem, the MySQL database held references to the old installation making previous uploaded content 404's. I had to download the database and replace those references.

Other than that everything went smoothly.
 
In the end I ran into one problem, the MySQL database held references to the old installation making previous uploaded content 404's. I had to download the database and replace those references.

Other than that everything went smoothly.

If I had seen this earlier would have given you some great advice. There is a plugin called duplicator. It creates a installer.php and zips up the entire directory into a file installer.php recognizes. You place these files wherever you want, run installer.php, asks you about new DB settings (if on a different site) and it does the rest. Works great!

BTW if you want to backup your site and DB contents i would recommend this plugin. Cant be beat for full backups and restores.
 
Basically heres the steps:
1. move all the files from the child folder into the html root
2. edit your database to point to the new address
3. login to WP admin and update your permalinks

done

contact me if you need help
 
It might be worthwhile investigating why that file gets overwritten each time. It might be a symptom of a serious problem which is going unnoticed. Like a hacker :)
 
or an auto update from fantastico or another auto installer on the shared webserver ;)
 
Top
Sign up to the MyBroadband newsletter
X