Link to home
Start Free TrialLog in
Avatar of wakatashi
wakatashi

asked on

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.
Avatar of TunerML
TunerML
Flag of Jamaica image

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?
Avatar of wakatashi
wakatashi

ASKER

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.
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:

https://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_10258-How-To-Move-A-WordPress-Site.html

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?
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
@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.
@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.
the k2 theme is 4 years old, what version of WP and PHP are you using?
ASKER CERTIFIED SOLUTION
Avatar of ScorchD
ScorchD
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
@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.