Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

WordPress MultiSite Migration from LocalHost to Server WordPress

  • SOLVED

Ok. So I developed a WordPress MultiSite project on my localhost and am trying to migrate it to my clients web server. First I tried backup buddy, that created a bunch of problems. So I decided to do the migration manually. So after manual migration this is what I get.

http://www.downtownchathamcentre.com

Everything seems fine. But when you try to goto an internal page, well, you'll see.

I have verified that mod_rewrite is enable and overrides is set to all.

My htaccess file is as follows:


RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]


And the multisite portion of my wp-config.php file looks as follow:


/** Turn on MultiSite **/
define('MULTISITE', true);
define( 'SUBDOMAIN_INSTALL', false );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'www.downtownchathamcentre.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );


I did the manual migration by performing a find and replace on the sql queries generated by the backup in phpmyadmin.

Answers (9)

2010-09-27

MagoryNET answers:

Maybe the server doesn't allow mod_rewrite (it would be strange, because it's Apache, but it could happen on some cheap servers)?


Bill Johnson comments:

The server administrator has confirmed that it does support mod_rewrite and that it is on and working for other websites.


MagoryNET comments:

In Wordpress .htaccess there is a line:

RewriteRule . /index.php [L]


In yours:


RewriteRule . index.php [L]


Maybe the lacking / is the problem? Try adding / in the last line...


Bill Johnson comments:

Negative. Didn't help.


MagoryNET comments:

Try resaving permalink options in wp-admin.
If it doesn't work then I don't know.


Bill Johnson comments:

How do I resave permalinks? I've gone to permalinks and changed the structure several times. I imagine this does that. It works when it is set to default, well the internal pages work, however, I still can't goto any of the networked sites.

2010-09-27

Kailey Lampert answers:

Here's a longshot, but you never know. Add this to the top of your htaccess:

<Directory />
AllowOverride All
</Directory>


Bill Johnson comments:

Adding that to my htaccess file did nothing. I contacted the server administrator to make sure he added between the directory tags.


Kailey Lampert comments:

In some situations, you may need to modify the opening <Directory> tag to include the server path

<Directory "/var/www/html">
AllowOverride All
</Directory>

2010-09-27

Monster Coder answers:

Where you put the .htaccess file? Check if it is installed on wordpress root directory! Check it has proper permissions/ownership!


Bill Johnson comments:

My htaccess file is in public_html directory, the same place as WordPress is installed. The permissions are set to 777 and I don't know how to check or change the ownership. However, I installed wordpress using FileZilla the same way I do every time.


Monster Coder comments:

even if the mod_rewrite is enabled, so far I guess you need overriding abilities. the apache vhosts should give you that privilege. please tell to your system admin! if still does not work, we should not guess anymore! if possible please send me cpanel login in PM to check.

thanks


Bill Johnson comments:

The server administrator has assured me that both mod_rewrite is enables and overrides is set to all. However, I have no way to check this. The client I am working with is a marketing company that outsources some random guy to manage their server and he does everything command line. No cpanel no nothing.


Bill Johnson comments:

Just got this from the server administrator:

you can't have "override all" on the root directory that would allow access to every single file on the whole server which is a huge security risk. Directory directives are absolute system paths and not local url paths. Your personal directory for the downtown chatham center is /home/dtcc/html so the current apache configure options for your site are as follows.

<VirtualHost 190.120.230.233:80>
ServerAdmin [email protected]
DocumentRoot /home/dtcc/html
ServerName downtownchathamcentre.com
ErrorLog /home/dtcc/logs/downtownchathamcentre.com-error_log
CustomLog /home/dtcc/logs/downtownchathamcentre.com-access_log common
</VirtualHost>
<Directory "/home/dtcc/html">
Options Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>

So that all looks good to me.


Monster Coder comments:

yep, the vhost config looks good to me too!

2010-09-27

Maor Barazany answers:

Try just go the admin panel permalinks and just re-save them.
This will activate the flush rewrite and might solve your problem


Tr do it in one of the sites and see if it helps, if it helps and other sites are unavailable too, you might need to re-save permalinks in the admin panel of each site to have them all working well.


Bill Johnson comments:

I have re-saved the permalinks multiple times. Also, I cannot get to the dashboard for individual sites without rewrites working.


Maor Barazany comments:

Does it work if you change permalinks to default, or it doesn't also with this?

Another thing - check in the DB if the sites are well listed in the <strong>wp_blogs</strong> table


Bill Johnson comments:

If I change permalinks to default you can view the WordPress pages but not the multisite blogs.

wp_blogs contains all the blogs and correct domain and paths


Maor Barazany comments:

Does everything working well on your localhost installtion?


Bill Johnson comments:

Everything works fine. Just the way it should on my localhost.

2010-09-27

Bill Hunt answers:

It might be worth turning on the RewriteLog and seeing what's being rewritten, exactly. You'll need to set it to a file that the server can actually write to, of course. After RewriteEngine On, add:


RewriteLog ~/your-file-path/rewrite.log
RewriteLogLevel 10


That'll let you know what's actually happening on the rewrite front, if anything.


Bill Johnson comments:

Hmm cool. I'll try that now.


Bill Johnson comments:

I can't get this to work.

I creates a folder and file at: /errors/rewrite.log

And I added the following to my .htaccess file so it now looks like this:


RewriteEngine On
RewriteLog ~/errors/rewrite.log
RewriteLogLevel 10
RewriteBase /
RewriteRule ^index\.php$ - [L]


# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . /index.php [L]



Bill Hunt comments:

You might need the full file path with that, ~/ might not work. The directory will also need to be writable by the web host, of course.

2010-09-27

Duncan O'Neill answers:

Bill,

if you did the migration manually, it sounds like some of the options in your database are still using the options for localhost.

So, you may need to do some db updates. To check whether this is the case, go to phpMyAdmin, or whatever you use, and make the following query, replacing "localhost" with whatever you used for your hostname on your localhost version of the site.

SELECT * FROM `wp_options`WHERE `option_value` LIKE '%localhost%'

If that returns some results ( and not just an empty set ), then your db needs updating to reflect the live hostname.

Here are some examples of the queries you need to make;

(Obviously, back up the db first )...



update wp_options set option_value=replace(option_value,"localhost address","http://www.downtownchathamcentre.com/");

update wp_posts set post_content = replace(post_content, "localhost address","http://www.downtownchathamcentre.com/");

update wp_posts set guid = replace(guid,"localhost address","http://www.downtownchathamcentre.com/");

update wp_postmeta set meta_value = replace(meta_value, "localhost file path","live server file path");

update wp_comments set comment_author_url=replace(comment_author_url,"localhost address","http://www.downtownchathamcentre.com/")


Bill Johnson comments:


SELECT * FROM `wp_options`WHERE `option_value` LIKE '%localhost%'


Returns zero results.


Duncan O'Neill comments:

Did you replace "localhost" in the query with whatever host-name you used to develop the site on your local server?


Duncan O'Neill comments:

Another query, which will point to the same issue;

SELECT * FROM `wp_posts` WHERE `guid` LIKE '%localhost%'

again, replace "localhost' with whatever you used for the host-name on your local machine.


Bill Johnson comments:

I replaced 'localhost/dcc' with 'http://www.downtownchathamcentre.com'


Duncan O'Neill comments:

Hi again Bill,

no, don't replace localhost/whatever with the name of LIVE server. You're looking for instances of where the db is referring to the LOCAL server.

So, the queries I gave you are looking for instances of where the db on the LIVE server is still referring to the LOCAL server.

The fact that you found no references to the LIVE server points again to this being the problem.


Bill Johnson comments:

There are no instances in the DB on the LIVE server where it still refers to the LOCAL server.

You said:
<blockquote>
The fact that you found no references to the LIVE server points again to this being the problem.
</blockquote>
However, I wasn't searching for references to the LIVE server, I was searching for references to the LOCAL server on the LIVE server's DB.

I have already replaced ALL references to the LOCAL server on the LIVE server's DB.

2010-09-27

Denzel Chia answers:

Hi,

I had recently installed my multisite with sub-directories network.

If your wp-config.php definitions and .htaccess rules are created by WordPress, then they should be correct.

I think in posts table, your guid for your post entry may be wrong.

I had added define('WP_POST_REVISIONS', FALSE); in my config.php
to stop post revisions so as to see what is the actual post created in the database.

I set my permalink to month and name, which is http://denzeldesigns.org/blog/2010/09/sample-post/
All my permalink selections had a /blog/ in it, except the default permalink structure which is
http://denzeldesigns.org/?p=123

I had visited your site and tested out http://www.downtownchathamcentre.com/?p=3
and it shows your About Us page, which leads me to think maybe your permanlink structure is wrong.

And in your database posts table, please find your About Us entry, which is ID 3.
Go to the guid field, the entry inside should be http://www.downtownchathamcentre.com/?p=3
and not other structure. Since you said that you manually imported all the entries, so I think your guid may be wrong too.

If you have post revisions the guid will look like this http://denzeldesigns.org/blog/2010/09/15-autosave/
for permalink structure month and name.

Hope the above information helps.

Thanks





Denzel Chia comments:

Visited your website today, looks like your problems are still not solved yet.

Why don't you use WordPress export to break your content from your localhost into a few export files and import to your new site?

If you do it this way, you will not need to worry about anything.
Although doing the WordPress way is slower but instead of trying to solve your present situation, why don't you put your waiting time to good use?

Nothing beats doing the "WordPress Way".

Thanks.

2010-09-27

Tom Ransom answers:

I suspect MagoryNet is on the right track - rebuild your permalinks

Also go to /wp-admin/options.php for a quick read through to see if anything looks amiss (those global search and replaces can kill you sometimes.)

Going to the posts/pages by id is working so permalinks is a good place to start.


Bill Johnson comments:

I only performed a search and replace on the backup query phpmyadmin generates for migration.


Tom Ransom comments:

Then you have two separate issues -
1) Getting Permalinks working
2) Getting access to your subdomains

these are unrelated.

For issue #2 - you need to make sure that there is a Wildcard DNS setup. - you or your host has to create a vhost for *.downtownchatamcentre.com

The wildcard needs to resolve to the downtownchatamcentre.com location.

Baring that you'll need to CNAME each whatever.downtownchathamcentre.com to downtownchathamcentre.com

If you rebuild the permalinks for the main blog - change the permalinks to the default (Save) and change back to your desired structure (save again) - that should provide a solution for the main blog.


Bill Johnson comments:

Multisite is not setup to use subdomains. It uses subdirectories.

I've tried:

<blockquote>
If you rebuild the permalinks for the main blog - change the permalinks to the default (Save) and change back to your desired structure (save again) - that should provide a solution for the main blog.
</blockquote>

Many times, it hasn't helped.

2010-09-27

fuscata answers:

EDIT: deleting this as it was for WPMU 2.9


Bill Johnson comments:

I am using the new MultiSite feature in WordPress 3.0.1