Use wildcard DNS (in 4 steps)

Sometimes you need your visitors to access your website from different subdomains and you don't know which ones they will be. Say you want to create a shopping cart that uses the URL format: http://product.store.com. This is a perfect situation for wildcard domains.

First you need to access your DNS section in the Plesk control panel and add an A record with an * (which means "wildcard"). Plesk will ask you "Enter domain name:" and in the textbox to the right you just enter an asterisk (*). It will also ask you to enter an IP address. You will use the IP corresponding to your domain name. Save settings.

Let's assume your domain is called "domain.com"

Second, login via shell to your account and edit this file:

/var/www/vhosts/domain.com/conf/vhost.conf

Add the following line:

ServerAlias *.domain.com

Third you need to "reconfigure" the domain. Use this command (I think you need root access for this)

/usr/local/psa/admin/bin/websrvmng -u --vhost-name=domain.com

You now need to restart Apache. Do this either from the command line like:

$service httpd restart

... or simply use Plesk's Services icon (you'll need admin privileges)

That's it! You should now be able to access your browser like:

  • something.domain.com
  • something-else.domain.com
  • etc.domain.com
Leave a comment
Name
Email (optional)
Your email will only be used to show your Gravatar and to send you replies to this article (if you opt to receive them). You won't get ANY other messages at all!
Comment
No HTML allowed
Notify me via email
 
 
Share

Valid HTML 4.01 Strict