Skip to content

Instantly share code, notes, and snippets.

@pongstr
Created May 23, 2013 00:50
Show Gist options
  • Save pongstr/5632049 to your computer and use it in GitHub Desktop.
Save pongstr/5632049 to your computer and use it in GitHub Desktop.
Wordpress Multiple Blogs with *wildcard domain

Wordpress Multisite Setup for local development.

After you've copied wordpress folder/files to your localhost directory, create the wordpress database like you normally would and once you've done that, follow these steps carefully:

###Step 1: CREATE SITE ALIAS

If you're not using MAMP Pro or any fancy webserver, you'll have to create this manually by editing your host file, here's how:

open your terminal and type these commands in:

sudo vi /etc/hosts" 

# add the following lines:
127.0.0.1    wordpress
127.0.0.1    project1.wordpress
127.0.0.1    project2.wordpress 
  
# save and exit. the command to do this is: 
:wq!

###Step 2: EDIT APACHE CONFIG FILE

Press cmd + shift + g and paste this: /Applications/MAMP/conf/apache/ open the file "httpd.conf" with your favorite text editor. In that file, search for # NameVirtualHost * and replace it with this one:

NameVirtualHost *
<virtualHost *>
  ServerName example.com
  ServerAlias example.com *.example.com
  DocumentRoot "/Applications/MAMP/htdocs/"
<directory "/Applications/MAMP/htdocs/">
    Options Indexes FollowSymLinks Includes
    AllowOverride All
    Order allow,deny
   Allow from all
</directory>
</virtualHost>

if it doesn't exists, add it underneath <VirtualHost> definition.


###Step 3: ENABLING WORDPRESS MULTISITE

Follow the official instructions from Wordpress Codex

If all goes well and you are able to login to your site's Dashboard, good job! however if you get the usual bug where when you login, you only get redirected to the same page, don't panic, take a deep breath and add this to your 'wp-config.php' to the line before the comment: /* That's all, stop editing! Happy blogging. */

define('ADMIN_COOKIE_PATH', '/');
define('COOKIE_DOMAIN', '');
define('COOKIEPATH', '');
define('SITECOOKIEPATH', '');

hit save, and try logging in again. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment