Support » Localhost Installs » Network installaion with SubDomains on XAMPP

  • Resolved Shasta


    I’m trying to create an identical copy of my live site on my local server so I can use it for development. I installed XAMPP (on Win7). I can get WordPress running, but as soon as I try to set it up as a network install it fails. (I’m also building the database by importing the backup from the live site, if this matters.)

    I’ve double checked that wp-config.php has the correct database values, changed the server to localhost, etc., the user has all permissions, etc. But as soon as I try to install a subdomain based network I get this:

    Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

    I’m fairly sure this has to do with settings in Apache I may need to configure, but I’m not finding any tutorials about installing networks on localhost. I did find references to the requirement that wordpress be installed at the root, and I’m wondering if installing it here:


    is the problem. That maps to localhost/mywordpress, which isn’t exactly root, but I’m not sure what the equivalent of root would be for my localhost installation. I’m guessing that may be an apache configuration too…

    Can anyone point me to a tutorial, resources, or otherwise help me move forward on this project?

    [moved to Localhost install forum]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thanks. That was useful, but it was missing a key fact that had me running in circles for many hours: when you create virtualhosts you need to add an entry for localhost or you’ll clobber it. I initially added this:

    <VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/testsite"
     DirectoryIndex index.php index.html index.htm

    My XAMPP landing site at localhost stopped working. Since my WordPress installation wasn’t working, I didn’t realize for some time that what I’d basically done is said “anything going to port 80, please send it to this directory.”

    I figured it out with help from this Apache page:

    I also found this discussion understandable:

    Adding an entry for localhost got me back to a functioning XAMPP page:

    <VirtualHost *:80>
      ServerName localhost
      DocumentRoot "C:/xampp/htdocs/xampp"
     DirectoryIndex index.php index.html index.htm

    Then I moved everything (WordPress) out of the folder points to and put a plain old index.html Hello World. Apache properly directs to that page now.

    However, when I put the WordPress files back in and go to testsite, I redirect here:


    and I get an “object not found” error. At this point I’m pretty sure I’m back firmly on to “your WordPress is not configured correctly” territory. Any tips?

    The redirect was because I’d forgotten to update the 1p-config.php file from the live site (I’d done a fresh download along the way…)

    I’m back to “The page isn’t redirecting correctly”. If I replace the wordpress installation with a static index.html page in the testsite folder, I can get to it with, so I think the server configuration is now correct, so it’s probably WordPress now, right?

    Can anyone help me? I’m going on day five trying to install locally, and the online directions seem very sparse for 3.0 with network, so I’m going to document everything I can think of:

    I have this config:

    In my hosts file on my Win7 machine:

    In my httpd-vhosts.conf for Apache:

    NameVirtualHost *:80
    <VirtualHost *:80>
      DocumentRoot "C:/xampp/htdocs/testsite"
     DirectoryIndex index.php index.html index.htm
    <VirtualHost *:80>
      ServerName localhost
      DocumentRoot "C:/xampp/htdocs/xampp"
     DirectoryIndex index.php index.html index.htm

    In my wp-config.php file:

    define ('WPLANG', '');
    define( 'COOKIEPATH', '/' );
    define( 'MULTISITE', true );
    define( 'SUBDOMAIN_INSTALL', true );
    $base = '/';
    define( 'DOMAIN_CURRENT_SITE', '' );

    .htaccess file in “C:/xampp/htdocs/testsite”: (unchanged from livesite)

    # BEGIN WordPress
    #<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    Well, I have more things working:
    [spaces are to prevent those URLS from linking]

    http:// works.
    http:// pages work too.

    But as soon as I try to go to http:// I get redirected to http:// (the online live version.)

    There must be a configuration hidden somewhere, but I can’t seem to find it. I tried a search and replace on an export of the database, but couldn’t re-import it, so I’ve manually updated the database tables wp_blogs, wp_site, wp_#_options, wp_sitemeta to eliminate mention of

    The .htaccess file also says define( ‘DOMAIN_CURRENT_SITE’, ‘’ );

    Any hints? This must be getting specific enough to sound familiar to someone…

    I’ve done more research…there is clearly a “” hiding in the configuration somewhere, as the wp_head and menu hooks are spitting out links with even though the site_URL is correctly set to

    I’ve manually inspected/updated the wp_blogs, wp_site, wp_#_options (where # is the subdomain blog I’m testing with), wp_sitemeta and wp_posts tables to eliminate mention of

    [It seems to me I should not have to update the GUID for posts, but as a test I did do that — seemed to make no difference.]

    I now have a localhost site which will function correctly as long as I type in every URL I want to visit. However the links on the page are being generated incorrectly.

    Can anyone tell me where else to look?

    All right..another increment of progress. I’d missed one of the in the options table. With that fixed, I can now use every link in the subsite EXCEPT the home link.

    So this works:
    <a href="">Comments</a>
    But this redirects to the live
    <a href="">Home</a>

    At this point I’m mainly documenting for the next poor fool who tries to do this, but I may as well post as I go in case anyone is listening…I’ll also post a followup with all the things I learned when I finally get it working.

    And it WORKS! In case anyone else is trying to install WordPress 3.x+ with subdomain network on localhost for testing, here are the steps:

    1) install XAMPP. Make sure you can get to http://localhost
    2) manually unpack WP files into C:\xampp\htdocs\yoursite or equivalent. Do NOT run the installer!
    3) export the database from your live site and download it.
    4) import that database using phpMyAdmin (http://localhost/phpmyadmin/)

    You’re going to need a *different* domain from your live site, so your browser can tell them apart. I called my local test site

    5) Edit these entries by changing to (or whatever you chose): WP_SiteMeta.siteurl, WP_Site.domain, WP_Options.home, WP_Options.siteurl, WP_Options.fileupload_url, WP_Blogs.domain

    Then for EACH blog edit
    WP_x_Options.home, WP_x_Options.siteurl, WP_x_Options.fileupload_url , where x is the number for that blog.

    [Note: if you changed the prefix for security, it might not be WP_ . Also, in theory you should be able to do a replace on the whole thing, but my import failed when I tried.]

    6) edit the wp_config.php file to reflect the connection to your database and the new domain you’ve assigned the site.

    7) now we need to add a virtual host entry to our localhost server. In my version of Apache that file is here:

    and I add this:
    <VirtualHost *:80>
      ServerName *
      DocumentRoot "C:/xampp/htdocs/site"
      DirectoryIndex index.php index.html index.htm
      ServerAlias *
    <VirtualHost *:80>
      ServerName localhost
      DocumentRoot "C:/xampp/htdocs/xampp"
     DirectoryIndex index.php index.html index.htm

    You’ll need to restart Apache now.

    8)Finally I add entries to my hosts file so my browser knows where to go when I type in


    [Note: I thought you could use *, but it doesn’t work. This means you have to add an entry for each blog, which is sub-par. Anyone know if there’s a way around that?]

    On Win7 the hosts file is here: C:\Windows\System32\drivers\etc\ . Windows will try to protect you by hiding the etc directory and preventing saves to the hosts file. Right click your text editor and “run as admin” then type the address in and you’ll be able to open and save hosts.

    (HINT: you can redirect sites your teen is grounded from by listing their IP here with a redirect to something else. I like “mother is watching” Bonus points for a hit-counter displayed on the page. 😉 )

    In theory it should all work now. Hahaha. I started this process a week ago, so there’s a decent chance I’ve forgotten some detail, but hopefully this will help you get closer faster.

    This thread has a useful comment regarding how to name the local network:

    (Trying to collect instructions in one place in the hopes it’s useful to someone.)

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Network installaion with SubDomains on XAMPP’ is closed to new replies.