This one had me stumped for a long time - how to use the ISPConfig interface to specify Co-Domains that should redirect vs. those that should simply be aliases...
Turns out it's easy, just not obvious.
Here's the scenario: I have a new hosting client who wants to run 2 separate Drupal
sites off of one account, with two separate domains: domainone.com and domaintwo.com. Because of Drupal's "multisite" capabilities, I want requests for both domains to go to the same DocumentRoot /srv/www/clientXX/web/drupal but to do so with the original domain name intact - i.e. I want the virtual host configuration to direct requests for both
domainone.com and domaintwo.com to that DocumentRoot without rewriting them. That's what I refer to as domain aliasing.
To complicate things, my clients want the www. subdomains to redirect to their respective naked domains, i.e. if a user types in the URL http://www.domainone.com
- it should get to the right place, but the domain that's actually fed to Apache should be domainone.com (without the www).
The way to achieve this is as follows:
1. create a "new site" or go to an existing site you want to modify
First the alias:
2. choose one domain as the "master" domain for the ISPConfig site "basis" - let's say domainone.com
3. go to the co-domain tab and enter "new" co-domain
4. set the "domain" to be domaintwo.com - enter nothing
else (no forward info or anything - this will be an alias to the default domain, domainone.com - but will not be rewritten to anything. This corresponds to simply creating a "ServerAlias" entry in the VirtualHost definition.
Now the redirects:
5. create a "new" co-domain, enter "www" for the host and "domainone.com" for the domain
6. then go to the "forward" tab and enter the full URL you want to redirect to: http://domainone.com
- this will create the appropriate ServerAlias entry as well as the Rewrite rules.
7. repeat 5 and 6 for domaintwo.com
Hope that helps someone!