Use www prefix with subdomain
Overview
Generally, the www prefix is not used when using subdomains. If you want to use the prefix with your subdomain, you can make a vhost file and add this behavior as part of your domain configuration. See below for more information on how to do this.
Requirements
Before you start, this article has the following dependencies:
- You must have SSH access set up for root or a sudo user.
- The domain example.com is used as an example. Be sure to replace this with your domain.
End of Life Warning
This service has a pending End of Life. Please move to a current service as soon as possible. For more information, please see: (dv) Dedicated-Virtual 4.0: Migration Information.
READ ME FIRST
This article is provided as a courtesy. Installing, configuring, and troubleshooting third-party applications is outside the scope of support provided by (mt) Media Temple. Please take a moment to review the Statement of Support.
Instructions
To create a www prefix for subdomains, you need to take the following steps:
-
Create a
vhost.conffile in the/var/www/vhosts/example.com/subdomains//var/www/vhosts/example.com/<as you designated>/directory with the following content:ServerAlias www.sub.example.com -
Add an appropriate A record to the DNS zone of the domain in Server->Domains->example.com->DNS (specify this domain's IP address instead of 192.168.1.1):
www.sub.example.com. A 192.168.1.1 -
Run websrvmng utility to apply changes via SSH.
/usr/local/psa/admin/sbin/websrvmng -v -a