Set up a WordPress Multisite Network on subdomains using MAMP PRO 5 on a Mac

Adding a multisite network to your local development environment can be a real pain. I wrote a script describing the major steps and configurations I use to get up and running. The goal here is to have the following sites set up in a local network for testing:

  • http://ms1.test (The main network site)
  • http://sub1.ms1.test (Subdomain site)
  • http://sub2.ms1.test(Another subdomain site)
  1. Start MAMP PRO and go to the Ports tab. Choose the option Set server ports to 80, 81, 443, 7443, 3306 and 11211
  2. Go to the Hosts tab and create a new host. Select the site root directory – any empty writable directory is fine. Check “Install WordPress” when creating the host.
  3. Add your desired WP admin user info and your local database credentials in the following dialog screen, then click “Create Host”.
  4. Stop and restart your webservers in MAMP if they are not automatically restarted for you.
  5. Check your local database to confirm the database was created successfully, and confirm in the wp_options table that the site URL is correct.
  6. Go to http://ms1.test/wp-admin in a browser and log in using the admin credentials you already provided.
  7. Edit your site’s wp-config.php file. Add the following line:
    define('WP_ALLOW_MULTISITE', TRUE);
  8. Reload the dashboard in wp-admin and go to Toolset > Network Setup. Select “subdomains” instead of subdirectories, and add your network title and admin email information.
  9. Copy the .htaccess code shown on the next page and save it into your site’s .htaccess file, overwriting any existing information. Disregard the other code and warnings shown on this page.
  10. Edit wp-config.php again. Remove or comment out the WP_ALLOW_MULTISITE line and paste the following lines just after it:
    define('MULTISITE', true);
    define('SUBDOMAIN_INSTALL', true);
    define('DOMAIN_CURRENT_SITE', 'ms1.test');
    define('PATH_CURRENT_SITE', '/');
    define('SITE_ID_CURRENT_SITE', 1);
    define('ADMIN_COOKIE_PATH', '/');
    define('COOKIEPATH', '');
    define('SITECOOKIEPATH', '');
    define('NOBLOGREDIRECT', 'http://ms1.test' );
  11. Save wp-config.php and return to MAMP PRO. Select the ms1.test host entry and find the Aliases panel. Add an alias for each subdomain:
    sub1.ms1.test
    sub2.ms1.test
  12. Save and restart the webservers.
  13. Go to ms1.test/wp-admin, where you will have to log in again. Use the network admin credentials.
  14. Go to My Sites > Network Admin > Sites, and add subdomains here as separate network sites.
  15. Log in to each site’s dashboard from Sites > All Sites.

f.lux

Ever notice how people texting at night have that eerie blue glow? Or wake up ready to write down the Next Great Idea, and get blinded by your computer screen? During the day, computer screens look good—they’re designed to look like the sun. But, at 9PM, 10PM, or 3AM, you probably shouldn’t be looking at the sun.

f.lux fixes this: it makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day.

It’s even possible that you’re staying up too late because of your computer. You could use f.lux because it makes you sleep better, or you could just use it just because it makes your computer look better.

f.lux claims to work on Windows, Linux and Mac. For Linux, there is a simpler alternative called redshift (with an optional redshift-gtk package).