modrewrite not working on my Apache setup

This is fairly easy to set up using virtual host configurations in Apache or Nginx (depending on which webserver you want to run on your box).

Here’s the gist of things:

1. Each installation will have a separate database and separate database user (for security).

I set these up manually in MySQL through the command line, but if you have phpMyAdmin set up, you can use that instead.

2. Each installation will be in its own directory. This keeps everything (core, themes, plugins) 100% separate.

For example, you might configure multiple directories for each domain. Assume you have myawesomesite.com and mybizsite.com, you’d set up:

  • /var/www/html/myawesomesite
  • /var/www/html/mybizsite

Each of these directories contains a distinct installation of WordPress. Separate files, separate wp-config.php, separate everything.

3. Use virtual hosts to listen for requests for each domain.

The default installations of both Apache and Nginx listen for all requests to an IP address and (usually) direct all traffic to /var/www/html. You can override this behavior by creating virtual hosts in your configuration to map specific host requests to specific folders.

For example, all requests to your IP address for myawesomesite.com would be served from /var/www/html/myawesomesite and all requests for mybizsite.com would instead be served from /var/www/html/mybizsite.

Keeping things separate like this also enables you to set up pretty permalinks because both sites use different .htaccess files (with Apache). So you could, essentially, have different permalink structures for each site.

Setting up a virtual host is pretty straight forward and well documented. There are tutorials around for just about every configuration. For Apache, you want to look up Name-based Virtual Hosts.

Setting one up in Nginx requires setting up a server_name in your configuration file. I use Nginx for all of my own hosting, and I did write up a tutorial on how I built up my CentOS server as well. Hope it helps!