Support / KnowledgeBase

 
Search the KnowledgeBase Search

Use www prefix with subdomain

  • Applies to: (dv) 2.0, (dv) 3.0, (dv) 3.5, (dv) 4.0

  • Difficulty: Medium

  • Time needed: 10 minutes

  • Tools needed: vi, root

 
  • Applies to: (dv) 4.0
    • Difficulty: Medium
    • Time Needed: 10
    • Tools Required: root access, vi knowledge
  • Applies to: (dv) 3.5
    • Difficulty: Medium
    • Time Needed: 10
    • Tools Required: root access, vi knowledge
  • Applies to: (dv) 3.0
    • Difficulty: Medium
    • Time Needed: 10
    • Tools Required: root access, vi knowledge

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:

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:

  1. Create a vhost.conf file 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
  2. 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
  3. Run websrvmng utility to apply changes via SSH.
    /usr/local/psa/admin/sbin/websrvmng -v -a

User Comments

No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article
Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue