Follow the 4 steps to make your subdomain accessible with www .
step 1: update vhosts.conf
Add one line to the special configuration file for the subdomain. Normally this file is located in /srv/vhosts/domain/subdomains/subdomain/vhosts.conf .
Create the file, if there is no file yet. Add the following line, save it and exit the editor.
What does ServerAlias www.subdomain.domain.com mean?
This is a Apache configuation that says that Apache will also serve the subdomain if you access it with www. This is normally used for the domain name, but also working for sub-domains.
step 2: update dns settings (optionally)
- Add a record type in the DNS zone of the domain for the subdomain starting with www. Select the following menu entries:
Server => Domains => domain.com => DNS
- There you’ll see a list of DNS entries for the domain. Check the IP address for the subdomain entry – copy to clipboard or write it down, if you don’t know it.
- Now you create a new entry with the button Add new entry – use the following values:
- Record type: A
- Domain name: www.subdomain (Plesk
- IP address: enter the IP address that you copied in step 2.2, e.g. 188.8.131.52
Press OK to add the new entry to the DNS.
- Check if there is a new entry wit the following value:
www.subdomain.domain.com A 111.1111.111.111
step 3: update plesk config file
Recreate the Plesk / Apache configuration for the whole domain with this command:
/usr/local/psa/admin/sbin/websrvmng -u --vhost-name=domain.com
step 4: restart apache
Restart Apache to read the new configuration and serve pages with www.subdomain.domain.com