• We value your experience with Plesk during 2025
    Plesk strives to perform even better in 2026. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2025.
    Please take this short survey:

    https://survey.webpros.com/

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