Solved: Multiple Domains with WordPress on One Server
WordPress has a feature called
MultiSite, which is often confused for “multiple websites (domains)”, but is in
fact “multiple sub-domains”. Although many people look forward to have multiple
websites (with different domains) with wordpress to install on single server,
but there is no simple solution from WordPress yet.
This post will help you in
configuring multiple domains using wordpress on single server. We will be using
Linux server (Ubuntu) with Apache 2.2 and wordpress 3.5.1 for our example. You
can use the same idea for different OS and IIS (or other web server).
NOTE: Backup your wordpress directory, wordpress database and web server files and directories before continuing with the steps mentioned below.
NOTE: Backup your wordpress directory, wordpress database and web server files and directories before continuing with the steps mentioned below.
After installation, wordpress
uses all its files (mostly php) for single domain. So we will need to have
multiple wordpress installation, each per domain (website). Installation of
wordpress in Linux is just downloading the latest.tar.gz file from
wordpress.org and extracting them in the desired directory (the root for your
website), and then configuring your DB (for each wordpress website) and finally
few lines in wp-config.php (for each wordpress website) according to the DB you
just configured. Just follow these
steps for installation of single wordpress for Ubuntu 12.04 from digitalocean.com. Repeat the steps each time for multiple domains as explained below. You may want to check
steps for your OS from Google.
Let’s say you have three domains
to be configured with wordpress in single server. You should have different root
directories for all these three websites. For eg.
Domain
|
Root Directory
|
abc.com
|
/mnt/abc/
|
pqr.com
|
/mnt/pqr/
|
xyz.com
|
/mnt/xyz/
|
The trick is to redirect to individual website
through the webserver (apache/iis) using “Virtual Hosts”. Depending on your
version of Apache, you can configure virtual hosts in appropriate file. In
Ubuntu 12.04, Apache 2.2 onwards, Virtual Hosts can be configured in /etc/apache2/sites-enabled/filename
as follows:
<VirtualHost *:80>
DocumentRoot /www/abc
ServerName abc.com
ServerAlias www.abc.com
ftp.abc.com mail.abc.com
# Other
directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/pqr
ServerName pqr.com
ServerAlias www.pqr.com
ftp.pqr.com mail.pqr.com
# Other
directives here
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /www/xyz
ServerName xyz.com
ServerAlias www.xyz.com
ftp.xyz.com mail.xyz.com
# Other
directives here
</VirtualHost>
|
Note: Restart
your Apache service after configuring virtual hosts.
You
can check for more examples on virtual hosts on apache here.
Now
your Apache will redirect the request for appropriate website to its corresponding
root directory. And from there, wordpress for that website will take control as
if it was the only wordpress on that server.
Advantages:
- You can have multiple (as much as you want) domains (websites) with wordpress on single server.
- All the wordpress for all websites are completely independent of each others.
- All the individual wordpress sites (domains) can work with single IP address.
Disadvantage:
- All the domains (websites) will have separate management, dashboard, etc. There is no single dashboard from where you can manage all your websites. This can only be done by WordPress in upcoming versions.
Comments
Post a Comment