M
mcalthrop
Guest
Hi,
I'm having trouble getting domain aliases to work properly.
Here are the steps I take:
1 - Create a hosting account for example.com (but I do NOT check the box that says WWW next to "Domain Name")
2 - Add a subdomain "www". NOTE: this is essential to the running of the CMS that I have written, so it's not possible to just check the WWW box on account creation.
3 - Create a domain alias alias.com .
Now here's what happens:
(a) www.example.com works fine
(b) example.com works fine
(c) alias.com works fine
(d) www.alias.com does NOT work
I've tried adding www.alias.com as a domain alias, but I get a Plesk error ("Error: Unable to set up the domain alias www.alias.com because a DNS record pointing to the host www.alias.com already exists.").
To a workaround: it took me ages to find, but I discovered what the docroot is under circumstance (d) above: it's the docroot of the domain that is used as the nameserver in plesk:
/var/www/vhosts/<nameserver.com>/httpdocs
So as an interim fix, I've put an index.php file in that folder that contains a massive switch statement to check the server name ($_SERVER["HTTP_HOST"]), and forward it to the required domain alias where possible.
This is a workaround, but really not sustainable: every time I add a domain alias via Plesk, I have to update the above file as well.
Can anyone help?
Matt
I'm having trouble getting domain aliases to work properly.
Here are the steps I take:
1 - Create a hosting account for example.com (but I do NOT check the box that says WWW next to "Domain Name")
2 - Add a subdomain "www". NOTE: this is essential to the running of the CMS that I have written, so it's not possible to just check the WWW box on account creation.
3 - Create a domain alias alias.com .
Now here's what happens:
(a) www.example.com works fine
(b) example.com works fine
(c) alias.com works fine
(d) www.alias.com does NOT work
I've tried adding www.alias.com as a domain alias, but I get a Plesk error ("Error: Unable to set up the domain alias www.alias.com because a DNS record pointing to the host www.alias.com already exists.").
To a workaround: it took me ages to find, but I discovered what the docroot is under circumstance (d) above: it's the docroot of the domain that is used as the nameserver in plesk:
/var/www/vhosts/<nameserver.com>/httpdocs
So as an interim fix, I've put an index.php file in that folder that contains a massive switch statement to check the server name ($_SERVER["HTTP_HOST"]), and forward it to the required domain alias where possible.
This is a workaround, but really not sustainable: every time I add a domain alias via Plesk, I have to update the above file as well.
Can anyone help?
Matt