• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Question Distinguishing www directory from the domain one

fbartolom

New Pleskian
I would like to direct accesses to www.domain and to domain to two different directories in Plesk. Yet when I try to add the www subdomain it says it is already there and in fact when I edit the 'domain' hosting setting a www is pre-printed before the editable domain name, differently from the other subdomain ones where the domain is pre-preinted instead. How may I set the thing to work the way I need?

Thanks, Fabrizio
 
i think it is a bit of an overshooting for just enabling a separate www directory. Are you sure there is no easier way? At any rate I found interesting the issue about error messages, I shall have to implement them to lead user to a custom error message I manually enabled on the old server.
 
Also
i think it is a bit of an overshooting for just enabling a separate www directory. Are you sure there is no easier way? At any rate I found interesting the issue about error messages, I shall have to implement them to lead user to a custom error message I manually enabled on the old server.
the editing should be done by editing php scripts, not configuration files, and tweaking factory code is a sure recipe for disaster. That is why inheritance was invented, for that matter.
 
At any rate I think I managed to modify the right piece of code:
PHP:
<?php foreach ($VAR->domain->webAliases AS $alias): ?>
    ServerAlias "<?php echo $alias->asciiName ?>"
<?php if (strcmp($alias, "taxiprofessional.net")) ?>
    ServerAlias "www.<?php echo $alias->asciiName ?>"
    <?php if ($OPT['ipAddress']->isIpV6()): ?>
    ServerAlias "ipv6.<?php echo $alias->asciiName ?>"
    <?php else: ?>
    ServerAlias "ipv4.<?php echo $alias->asciiName ?>"
    <?php endif; ?>
<?php endforeach; ?>
Yet when I connect to Plesk after having executed:
sudo /usr/local/psa/admin/sbin/httpdmng --reconfigure-domain taxiprofessional.net
I see no change altogether: it is still complaining:
Incorrect subdomain name www.taxiprofessional.net: the domain taxiprofessional.net already has the WWW prefix.
or
Error: Failed domain creation: Incorrect name www.taxiprofessional.net. This domain name already exists without the 'www' prefix.
I am unsure if my error is in the script or in the procedure.
 
Last edited:
Back
Top