0

I've just inherited a word press project that has been configured as a word press multi site. I typically just place the word press installation into a sub folder on my wamp server for development purposes, get a copy of the database, and then do a search + replace throughout the sql dump to have it resolve in my local environment, usually 192.168.1.10/project_name/

This project however is set up in it's production enviorment as a multi-site that responds to multiple domains. Is it possible to get this project to run in a wamp setup? If not, are there any suggestions on how to create a local development environment? If so can steps be provided on how to achieve this?

We are also going to need to get this project up and running in our staging enviorment which is typically ran as a windows server with IIS.

All of my attempts up to this point when trying to browse the multisite at http://192.168.1.10/project-name-here/ has been redirecting me back to the production site.

1

Yeah, there are a little more steps involved with Multisite. Here's how I did this for a recent project, after much mucking around:

  1. Set up virtual hosts rather than subfolders on your WAMP box

I'm on XAMPP so this will be a little different for you, but for me I just needed to add the following to c:\xampp\apache\conf\extra\httpd-vhosts.conf:

NameVirtualHost *:80

# Add a default virtual host, which will inherit any settings already made
<VirtualHost *:80>
</VirtualHost>

# Add additional virtual hosts here, changing only the settings you need to
<VirtualHost *:80>
    DocumentRoot "c:/xampp/htdocs/client-site"
    ServerName clientsite.localhost
</VirtualHost>
  1. Make sure the virtual host resolves to your box - use your HOSTS file for this
  2. Install the WordPress MU Domain Mapping plugin (note: apparently this is no longer required as the functionality has apparently been folded in to Core, but there's very little up-to-date documentation around Multisite and I found I still needed this plugin)
  3. Log in to WordPress Admin and go to Network Admin -> Settings -> Domain Mapping, and:
    • uncheck Remote Login
    • check Permanent Redirect
    • check User Domain Mapping Page
    • uncheck Redirect Administration Pages
    • check Disable Primary Domain Check
  4. Go to Network Admin -> Settings -> Domains, and add your local domain with a random site ID. Uncheck the Primary checkbox, and save.
  5. Manually edit the new database record that was just created in the wp_domain_mapping table, and set the site ID back to the ID of the site you are using (probably ID 1 if it's the main site) - this is because aliases on the primary domain are supported, but WordPress won't let you add them through the interface

Start developing locally!

I may have missed a step that I didn't document when I was setting this up, so please do let me know if this works and/or if you needed to do anything else.

  • 1
    Thanks Tim, which stack I end up using isn't so important, so I will definitely investigate XAMPP :) – Ryan Fletcher Jul 1 '16 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.