Move WordPress from Subdirectory to root

I created a new site design in a sub directory called “WPsite” - this site is now finished and I want to move it to the root of the site to replace the current site. What is the best way to accomplish this? I’ve read a few things on WordPress.or - but they are simply making me more confused. I tried an online chat with my web host and this is what he told me was the quickest way to do it:

Step 1 - Install fresh install of WordPress into the root directory
Step 2 - edit the WordPress config file to use the same database, user and password
Step 3 - copy the current wp-content folder into the WordPress install (from the WPsite directory to the root) - he said this would copy over all of my plugins, settings, and theme

Would this work? What about all of the navigation links? What about internal links? Has anyone had any experience with this method?

I have used WordPress for years and - though I have not performed this sort of migration, myself - the outline shared by your web host seems to make sense.But, since you are unsure about it, it is worth noting that you are not corrupting your original content by trying the fresh install as your web host suggests. If you try it and find there are problems, the original folders and files are still intact (waiting for another approach).
Regarding your question of links: It seems that WP is likely to generate new links, internally, based on new install directories. The most likely source of error here may be any links you have entered yourself, such as in a blog post. I suspect that those would have to be changed over manually.
HTH

I just tried this and as soon as I tried the “wp-admin/install.php” I got this:

“You appear to have already installed WordPress. To reinstall please clear your old database tables first.”

HELP! I don’t want to clear the old database!!

Please make sure you have a BACKUP of your database and files!

When you install WordPress the new database should be empty. Then, after it’s installed, you IMPORT the old database into the empty new one.

That is not what the original post stated. Line number 2 says: edit the WordPress config file to use the same database, user and password"
If it is connecting to the same database, it can’t be empty…this was very confusing.

The entire site is now a mess because I followed these instructions exactly.

I can see how that would be confusing, Unless I’m missing something I think what was meant was in terms of “connection details”. i.e. the same database name, not the same database.

The instructions made no mention of IMPORTing?

No, nothing was said about importing anything. The exact instructions were (this is a copy and paste from the on line chat I was having with tech support, I am Kelly):

Kelly: I’m not sure I understand - let me see if this is correct - I would install WordPress at the root directory - then I would attach it to the current database (that the subdirectory WPsite is now using)?
Cory P.: Yes, exactly correct, then you can just being the wp-content folder over into the main directory and the themes and plugins will be there as well
Kelly: It won’t mess up anything while there are two instances of WordPress using the same database?
Cory P.: Nope.
Kelly: That sounds a little too easy :slight_smile:
Cory P.: It is pretty simple really, the first few times I had seen it done I though it was difficult until I did it
Kelly: So…
Step 1 - Install fresh install of WordPress into the root directory
Step 2 - edit the WordPress config file to use the same database, user and password
Step 3 - copy the current wp-content folder into the WordPress install (from the WPsite directory to the root)
Step 4 - try not to panic :slight_smile:
Cory P.: Correct!

I have my host doing a full data restoration from a backup that was done on Saturday. Can someone PLEASE give me a list of instructions on how to move this the correct way (dumb it down for me…my brain is fried from this)!!

Hmmm, searching for “You appear to have already installed WordPress. To reinstall please clear your old database tables first.” sure brings up a lot of pages - unfortunately none helpful that I could tell.

The install file has

// Let's check to make sure WP isn't already installed.
if ( is_blog_installed() ) {
	display_header();
	die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p><p class="step"><a href="../wp-login.php" class="button">' . __('Log In') . '</a></p></body></html>' );
}

And the is_blog_installed function has a few "return true"s

function is_blog_installed() {
	global $wpdb;

	// Check cache first. If options table goes away and we have true cached, oh well.
	if ( wp_cache_get( 'is_blog_installed' ) )
		return true;

	$suppress = $wpdb->suppress_errors();
	if ( ! defined( 'WP_INSTALLING' ) ) {
		$alloptions = wp_load_alloptions();
	}
	// If siteurl is not set to autoload, check it specifically
	if ( !isset( $alloptions['siteurl'] ) )
		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
	else
		$installed = $alloptions['siteurl'];
	$wpdb->suppress_errors( $suppress );

	$installed = !empty( $installed );
	wp_cache_set( 'is_blog_installed', $installed );

	if ( $installed )
		return true;

	// If visiting repair.php, return true and let it take over.
	if ( defined( 'WP_REPAIRING' ) )
		return true;

My guess is it’s the “siteurl” field in the options table that’s the culprit. You’ll need to change this anyway, so maybe if you deleted that value (only that one!) and tried things again?

@JustDucky The best way to move wp from a sub folder to the root is to just copy 2 files the index and htaccess. Read more about it here

http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

My domain host wants to "do a document root change for the account to point to the folder where the data is ". This sounds scary to me, does anyone have any experience with this?

HELP!!

This has been a total nightmare! I found a - not perfect, temporary - solution. I added a re-direct to the .htaccess file and now at least the new site is visible (of course the sub directory name “WPsite” is in the URL). I needed to get the site up and my client is happy. This way, I can take some time and research the best way to do this. The WP site has a custom theme and many custom sidebars and such. I used Artisteer and Templateer to create the template… I’m afraid it’s going to be very complicated to move.

The site is http://donsanni.com I would greatly appreciate anyone that has WordPress expertise to look at it and advise me. Feel free to contact me here or through a PM with any questions.

Did you check the link I have posted above? It will definitely take care of your issue and there are no changes to be made to the folder. I have done that numerous times and works fine. Its know as installing WP in a subfolder. Though WP will be in the WPsite folder like in your case - the URL displayed will be http://donsanni.com and not http://donsanni.com/WPsite like it displays now. Do study the link and let me know if you face any issues.