Wordpress - moved to new server with different URL. Content is 404 Not Found

We have a Wordpress site used as a company Intranet.  It was previously accessible on the old server at http://oldserver/wordpress, and I want to move it to http://newserver/wordpress.

So I've done the following:

1. Copied all files from the /wordpress directory on the old server, to the /wordpress directory on the new server.

2. Dumped the old database to a file with "mysqldump -u root -poldpass wordpress > database.sql"

3. Created a database called "wordpress" on the new server.

4. Created a user on the new server with the same name and password as on the old server.

5. Granted all priviledges on wordpress.* to the user.

6. Imported the database with mysql –u root –pnewpass wordpress < database.sql

7. Downloaded the Search and Replace tool from http://interconnectit.com/products/search-and-replace-for-wordpress-databases/, and used it to replace instances of the string "oldserver" in the database with the string "newserver".

Now when I load the page "http://newserver/wordpress" into a browser, the structure of the template appears, but I get "Error 404 - not found" where the content should be.

I can access http://newserver/wordpress/wp-admin and log in there successfully.  Under Settings | General, the Wordpress Address URL and the Site Address URL both read "http://newserver/wordpress".

Under "Pages", it reports "No pages found", although at the top of this page it says All(36)|Published(34)|Draft(1)|Private(1).

Permalink settings (which seem to be the cause of this kind of trouble for many people, it seems) are set to "Default".  I've tried changing it to something else, and back again without any joy.

There is an .htaccess file at the root of the site, but it doesn't contain anything more than "# BEGIN Wordpress", a blank line, then "# End Wordpress".

User and Group for all files in the /wordpress directory and below is "www-data".

How can I get the content to appear on the new server?  I've done a lot of Googling and there are a lot of suggestions regarding permalinks, but as far as I can see they don't apply here.
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

ScorchDConnect With a Mentor Commented:
What I meant is clear the permalink structure from the database field, if you are able to view the admin it shouldnt be anything to serious, what I would do is turn off all of your plugins, if you strip it back to just a simple Wordpress install with communication to the database you should be able to find the issue.
Obvious question, you dont have any sort of caching plugin?
This might have all been done a lot easier using the wordpress export tool and re-importing it to the new server? I assume it's too late to now do that?
wakatashiAuthor Commented:
Not necessarily too late, no.  I didn't think the Wordpress export tool was an option when changing URL like this though, is it?  

If so, if you could please let me know how you'd go about it, I can give it a whirl.
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

Jason C. LevineNo oneCommented:
I didn't think the Wordpress export tool was an option when changing URL like this though, is it?  

It's not.

Check this article:


Basically you want perform the search and replace after your step 2.  The article above discusses it in detail.
I would go back before the search and replace operation, in the database you only need change the URL values within the wp-options table and remove the permalink entry.

Change the wp-config file which you have obviously done correctly and you should have a working site to get you started. Its always worth checking DNS aswell if it is only the homepage that is not resolving?
James RodgersWeb Applications DeveloperCommented:
try exporting the db using wp_migrate DB, this will do a find replace on the old and new URL AND update the serialized data
wakatashiAuthor Commented:
@jason1178: I've been through the process detailed in the article, which differed from the way I did it originally, in that first time around, I did the following:

1. Copied the entire Wordpress directory and its contents to the new server
2. Dumped the database on the old server, ran the Search and Replace tool on it, and uploaded the result on the new server with the "mysql" command.

The article you linked me to suggests clean-installing Wordpress on the target server, and copying only the "wp-content" folder from the old server.  The database is handled in the same way.

But my result is, I'm afraid, exactly the same.

@ScorchD: URL in the wp-options table in the database is correct for the new server.  What did you mean by "remove the permalink entry"?  We're using the default permalink format of "http://server/wordpress/?p=123", so it's nice and simple.  In that respect, anyway!  DNS resolves to the correct IPs for both old and new server hostnames - the servers both reside on our LAN, so that's pretty straightforward too.
wakatashiAuthor Commented:
@Jester_48: Hadn't come across that plugin.  Installed and ran it, and it displayed the following error multiple times in a row:

Warning: Missing argument 1 for k2sbmModule::k2sbmModule(), called in /var/www/wordpress/wp-content/plugins/wp-migrate-db/wp-migrate-db.php on line 612 and defined in /var/www/wordpress/wp-content/themes/k2/app/classes/widgets.php on line 493

However, it did spit out a .sql file which I duly imported into the new server.  No dice though, I'm afraid - exactly the same result, darn it.
James RodgersWeb Applications DeveloperCommented:
the k2 theme is 4 years old, what version of WP and PHP are you using?
wakatashiAuthor Commented:
On the old server, it's PHP 5.2.6-1+lenny 9, WP version 3.5.1.

On  the new server, it's PHP 5.3.10-1ubuntu3.6.

I'm trying to migrate the Wordpress install exactly as is, including the theme.  The WP install is something I inherited - it's a kind of "Intranet" site - and I'd really prefer not to mess with it at all at this stage.  I just want to get it up and running on the new server unmodified if I can.
wakatashiAuthor Commented:
@ScorchD - yes, yes YES!!  Turning off all the plugins has allowed the content to be displayed.  You, sir, are a gentleman and a scholar.

It should be a simple matter of narrowing down the offending plug-in from here, so I would say that's a win.  Thank you!

And thanks to everyone else too.  I am a happy man.
All Courses

From novice to tech pro — start learning today.