WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Can't access sites on localhost (working fine online) (3 posts)

  1. Xonox
    Member
    Posted 2 years ago #

    Hi,

    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 (XAMPP) to make some theme developments. I can access my main site at local.maindomain.com, however, how can I access the other sites (site1 and site2)?

    This is what I have in my hosts file:

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

    This is my vhosts

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

    On the dashboard, if I choose "Visit Site" it tries to get to local.maindomain.com/site2 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

    I've been trying to get this solved for a couple of days now, any help is welcome, thanks.

  2. Xonox
    Member
    Posted 2 years ago #

    I had a break thru.

    On wp_2_options, changing fileupload_url to local.site2.com gave me access to the site2's backoffice (local.site2.com/wp-admin/).

    However trying to acces the site itself redirects me to the online server:

    local.site2.com -> site2.com

    What am I missing?

  3. Xonox
    Member
    Posted 2 years ago #

    BINGO!

    Changed primary domain to local.site2.com on the Domain Mapping plugin and everything is working fine!

    Thanks for your help... oh wait, no one answered! No problem, this is a fine forum.

    Happy pressing to you all and I hope this "recipe" is useful to someone.

Topic Closed

This topic has been closed to new replies.

About this Topic