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.
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.conf
file in the/var/www/vhosts/system/example.com/conf/
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 httpdmng utility to apply changes via SSH.
/usr/local/psa/admin/sbin/httpdmng --reconfigure-domain example.com