0

Hello I think this is a beginner question, but I just do not know how to achieve this:

Imagine the following:

/public_html/  [Domain = foo.com]
/public_html/wp_subproject1/ [Domain = bar.com]
/public_html/wp_subproject2/ [Domain = anything.com]

Each folder, the main folder as well as two subfolders contain a WordPress project which should have their own domains (so it should not be obvious to the user that these different projects lay on the same server).

How do I configure the server to achieve that? Do I have to set the the A or CNAME record for each domain to the same server and afterwards route to the correct project using .htaccess? How should this .htaccess look like?

1 Answer 1

1

Depending on what server setup you have (operating system, http server & control panel - if you have one), the main way to go would be to have separate DNS zones for each domain (with an A record for the domain name, then MX records, NS if you want the nameservers to be linked to that specific domain, reverse lookup and other stuff), then have a virtual host for each domain, having the DocumentRoot point to the specific installation folder.

For the classical LAMP stack, the virtual hosts would most likely look something like (a very basic setup - the minimum number of directives needed to accomplish this task):

<VirtualHost *:80>
    ServerName  foo.com
    DocumentRoot /public_html
    <Directory /public_html>
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName  bar.com
    DocumentRoot /public_html/wp_subproject1
    <Directory /public_html/wp_subproject1>
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName  anything.com
    DocumentRoot /public_html/wp_subproject2
    <Directory /public_html/wp_subproject2>
        Options Indexes MultiViews FollowSymLinks
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
</VirtualHost>

As far as keeping the user from actually knowing that your domains sit on the same server, I believe you want them to see each website on its' own, which is what this setup does. In terms of actually hiding this fact from advanced users, things get more complicated since a simple ping on each one of the domains would reveal that they are on the same IP (so yould need to hide this - have 3 separate IPs and do some fancy magic to route calls to each of the domains through one of the IPs).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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