How to add a sub-domain in Plesk with www prefix?

Generally, a sub-domain is not accessed using the www prefix i.e. you can access subdomain.domain.tld but not www.subdomain.domain.tld by default.

Solution:

To make a subdomain work with ‘www’ prefix on a Plesk server, you have to add a ServerAlias entry in the vhost configuration of the sub-domain and add an A record from Plesk.

Steps:

1. Create a vhost.conf file for the sub-domain

# cd /var/www/vhosts/domain.tld/subdomains/<sub-domain>/conf
# nano vhost.conf

and add a ServerAlias entry

ServerAlias www.subdomain.domain.tld

2. Add an ‘A’ record for the ‘www’ prefix of the sub-domain from
     Plesk -> Domains -> <domain.tld> -> DNS Settings -> Add Record

www.subdomain.domain.tld A 1.1.1.1

3. To apply the ServerAlias changes, run the websrvmng utility

# /usr/local/psa/admin/bin/websrvmng -a

4. Restart the webserver

# service httpd restart

Replace the subdomain/domain name and the 1.1.1.1 IP with the actual values.

This entry was posted on Saturday, September 17th, 2011 and is filed under Plesk Management. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.