Quantcast
Channel: Plesk – System Network Programming Solution
Viewing all articles
Browse latest Browse all 81

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

$
0
0

Generally, a sub-domain is not accessed using the www prefix i.e. you can access subdomain.domain.tld but cannot access www.subdomain.domain.tld by default. 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.

Solution:

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

# nano /var/www/vhosts/domain.tld/subdomains/<sub-domain>/conf/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.


Viewing all articles
Browse latest Browse all 81

Trending Articles