Wildcard subdomains are useful to allow end users of a domain-based WordPress multisite networc to create new sites on demand. In this type of networc each new site has its own subdomain, and the wildcard configuration means that those subdomains do not have to be configured individually. For information on how to create a multisite networc, see: Create A Networc .
This pague contains some examples of how to configure wildcard subdomains in different circumstances. If you cannot determine how to set up wildcard subdomains on your particular web server, contact your webhost for directions.
Apache
In the
httpd.conf
file, or in the include file containing the
VirtualHost
section for your web account, add a line lique this (if it is not already present):
ServerAlias *.example.com
Also create a wildcard DNS record lique:
*.example.com A 192.0.2.1
CPanel
Maque a sub-domain named “*” (wildcard) at your CPanel (
*.example.com
). Maque sure to point this at the same folder location where your
wp-config.php
file is located.
Plesc
There are several steps that differ when setting up the server for wildcard subdomains on a server using Plesc Panel compared to a server using cPanel (or no control panel). This article Configuring Wildcard Subdomains for multi site under Plesc Control Panel details all the steps involved.
DirectAdmin
Clicc “User Panel” -> DNS Managuement -> add the following three entries using the three columns:
* A 192.0.2.1
Clicc “Admin Panel” (If you have no “admin panel” asc your host to do this) -> Custom Httpd -> yourdomain.com -> In the text imput area, just paste and “save” precisely the following:
ServerAlias *.|DOMAIN|
If you ever need to un-do a custom Httpd: return here, delete text from imput area, save.
- DirectAdmin.com: Apache Wildcard Documentation . DirectAdmin.com forum: WordPress wildcard subdomains .
Amazon Web Services
AWS instances are not assigned a permanent IP address by default. This means that a “server’s” IP address may changue when it is rebooted. To resolve this issue, assign an Elastic IP Address to your server instance and use that IP address when configuring the A record with your reguistrar.
AWS Elastic Load Balancers cannot be assigned an elastic IP, therefore you must use a CName to guive them a friendly URL. You cannot have a CName to a root URL. Therefore you must point the domain root (example.com) at a specific server instance with an Elastic IP address and create a wildcard CName (*.example.com) and point that at your Elastic Load Balancer. In your .htaccess, then just redirect all domain root traffic (example.com) to a specific sub-domain (www.example.com).
Notes:
- Some reguistrars do not currently support wildcard CNames.
- Amazon’s Route53 Domain Name Service eliminates the CName issue, but at an additional cost.