WordPress.org

Ready to get started?Download WordPress

Forums

Multisite local copy not working (14 posts)

  1. Xonox
    Member
    Posted 2 years ago #

    Hi,

    I have a problem that I guess it's easy to solve if you know where to look (which I don't).

    On my online server I set up Wordress multisite and everything is working fine:
    maindomain - ok
    site1.com - ok
    site2.com - ok

    Now I copied it to my local server for development (installed Xampp; Installed WordPress; Copied de Database; did all configurations), and everything looks fine except:

    localhostwp - ok
    local.site1.com - shows localhostwp
    local.site2.com - shows localhostwp

    I already changed the values "siteurl" and "home" on the "wp_options" table. But I probably need to make some more changes so that Worpress can display the right sites for local.site1.com and local.site2.com.

    What do I need to change? Thank you

  2. What'd you do in your hosts file?

    http://wpmututorials.com/how-to/using-a-hosts-file/

  3. Xonox
    Member
    Posted 2 years ago #

    Hi Ipstenu,

    This is what I have in my hosts file:

    127.0.0.1       localhost
    127.0.0.1       localhostwp
    127.0.0.1	local.maindomain.com
    127.0.0.1	local.site1.com
    127.0.0.1	local.site2.com

    When I put local.site1.com or local.site2.com in the browser, it always shows the main WordPress site, instead of the other two.

    I have XAMPP set up with two folders for servers, beeing localhost a simple webserver and localhostwp where I have the WordPress Installed.

    I don't know if it helps but here's my vhosts:

    <VirtualHost *:80>
    	DocumentRoot D:\Webserver
    	ServerName localhost
    	<Directory D:\Webserver>
    		Order allow,deny
    		Allow from all
    	</Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    	DocumentRoot D:\Webserver_WP
    	ServerName localhostwp
    	<Directory D:\Webserver_WP>
    		Order allow,deny
    		Allow from all
    	</Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    	DocumentRoot D:\Webserver_WP
    	ServerName local.maindomain.com
    	<Directory D:\Webserver_WP>
    		Order allow,deny
    		Allow from all
    	</Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    	DocumentRoot D:\Webserver_WP
    	ServerName local.site1.com
    	<Directory D:\Webserver_WP>
    		Order allow,deny
    		Allow from all
    	</Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    	DocumentRoot D:\Webserver_WP
    	ServerName local.site2.com
    	<Directory D:\Webserver_WP>
    		Order allow,deny
    		Allow from all
    	</Directory>
    </VirtualHost>
  4. maoski
    Member
    Posted 2 years ago #

    you cant use sub domains in localhost, you will have to use subfolder

  5. Samuel B
    moderator
    Posted 2 years ago #

    If you insist on choosing Sub-domains, whenever you create a new test blog (with the sub-domain test1), you will need to update the hosts file with the sub-domain entry.

    127.0.0.1 test1.localhost.localdomain
    notice the format

    ref:
    http://maketecheasier.com/install-wordpress-mu-in-windows-localhost-with-xampp/2009/05/02

  6. Xonox
    Member
    Posted 2 years ago #

    Hi Samuel B,

    I did what you said about the hosts file, however, it still doesn't work.

    Let me explain better what I need...

    On my online server I have 2 sites that are working fine on my WP installation, I copied everything (Files and DB) to my local server to make some developments. I can access my main site at local.maindomain.com, however, how can I access the second site?

    local.maindomain.com/site2/ shows "Object not found"
    site2.local.maindomain.com redirects to the main online site (maindomain.com)
    local.site2.com redirects to the main online site (maindomain.com)

    All this domains have hosts entries to 127.0.0.1. It looks like WP redirects to my online site instead of showing my 2nd site. It's probably some setting I must change.

    Please help me shine some light on this because I don't know what else to do. Thank you.

  7. Steveorevo
    Member
    Posted 2 years ago #

    Did you include the entries in your wp-config that define Multisite with subdomains vs subfolders? I believe there is a specific difference, yes?

  8. Xonox
    Member
    Posted 2 years ago #

    Steveorevo,

    I din't made any changes regarding that config. I wanted it to work the same way online and on localhost.

    I tried SUBDOMAIN_INSTALL with true and false and always had the same result (not working). Is this what you mean?

    On the dashboard (while on site2), if I choose "Visit Site" it tries to get to local.maindomain.com/site2/wp-admin/ but I get a "Object not found!" error.

    Here's everything I've done, step by step. There's some ingredient missing on this "recipe":

    1. Sync the WordPress files:
    
    	Delete all files before upload;
    
    2. Sync the database:
    
    	Delete all tables before upload new database;
    
    3. Change the following lines on wp-config.php:
    
    	define( 'DOMAIN_CURRENT_SITE', 'your-local-domain’ );
    	define( 'SUNRISE', 'off' );
    
    4. Check the following values on the database:
    
    	Table: wp_blogs
    	Field: domain
    
    	Table: wp_site
    	Field: domain
    
    	Table: wp_sitemeta
    	Field: meta_key > siteurl
    
    	Tables: wp_options / wp_*_options
    	Field: option_name > fileupload_url
    	Field: option_name > home
    	Field: option_name > siteurl
  9. Steveorevo
    Member
    Posted 2 years ago #

    Hmm. I know that we can do this in our paid product (see my post about the free "New localhost support for testing WordPress 3.3 Beta 1" in this forum) subdomains is a bit beyond the scope of this community forum. I don't want to be plugging a product and run the risk of being labeled a spammer :)

    I'm not sure why it works as it does, but I do know that it does work and it is certainly possible. You appear to be on the right track as serverpress.com does this with XAMPP, hosts, and vhosts alone. So I'm sure it can be done by hand just as well.

  10. Xonox
    Member
    Posted 2 years ago #

    Steveorevo, I'll check it out, thanks.

    About the scope forum, I agree with you, I guess I'm out context here so I'm closing this post and moving it here:

    http://wordpress.org/support/topic/cant-access-sites-on-localhost-working-fine-online?replies=1#post-2402353

  11. coombesy
    Member
    Posted 2 years ago #

    I'm having the exact same problem as Xonox

    I even tried to create the hosts entries first. I'm using ubuntu 11.10 just wondering if this might be a linux issues, or are you on win or mac xonox?

  12. Xonox
    Member
    Posted 2 years ago #

    Hi coombesy,

    I'm on a Windows system with XAMPP.

    I eventually got it to work. Unfortunately, you can only access one of the sites at a time.

    I'm not on my localhost machine right now. But as I remember, if you have multiple sites like:

    local.site1.com
    local.site2.com
    local.site3.com

    you can configure, on your wp-config.php:

    define('DOMAIN_CURRENT_SITE', 'local.site1.com’);

    and you'll be able to work on that site in particular. For me this is fine, because it is a dev machine so there's no trouble working on one site at a time.

    I also have WordPress MU Domain Mapping plugin installed. You'll have to set it to the right primary domain for each site. In this case: local.site1.com.

    See if this works for you. If it doesn't, I'll take a closer look to my local settings tonight.

  13. coombesy
    Member
    Posted 2 years ago #

    cheers for your reply,

    removed wp-config, deletd db tables, re-installed (same working copy) and then it worked!

    Would love to know why it wouldn't. Couldn't get it to work for past 3 weeks but was working on the main site (dev machine as well). There was an update recently, so maybe it was the re-install today after being updated that solved it?

    But now have it working full

  14. Xonox
    Member
    Posted 2 years ago #

    Hmm... in that case, I'll have to give it a try, too. :)

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic