End users of a domain-based WordPress multisite network can create new sites on demand with the help of Wildcard subdomains. In this kind of network each new site has its own subdomain, and the wildcard configuration means that the subdomains shouldn’t be configured individually.
I’ll give you some examples of how to configure wildcard subdomains in different circumstances. If you don’t know how to set up wildcard subdomains on your particular web server, you should contact your webhost for directions.
In the httpd.conf file, or in the include file that contains the VirtualHost section for your web account, add a line like this:
You can also create a wildcard DNS record like this:
*.example.com A 22.214.171.124
You can make a sub-domain named “*” (wildcard) at your CPanel (*.example.com). Just insure to point this at the same folder location where your wp-config.php file is.
There are some steps which differ when setting up the server for wildcard subdomains on a server using Plesk Panel in comparison with a server using cPanel.
For Direct Admin Panel, click “User Panel” -> DNS Management -> and add the following three entries using the three columns:
* A xxx.xx.xx.xxx
You should replace “xxx.xx.xx.xxx” with your website IP.
Click “Admin Panel” -> Custom Httpd -> yourdomain.com -> In the text input area, just paste and “save” precisely the following:
AWS (Amazon Web Services) instances are not assigned a permanent IP address by default. That is to say that a “server’s” IP address may change when it’s rebooted. To resolve this problem, you should assign an Elastic IP Address to your server instance and use that IP address when configuring the A record with your registrar.
AWS Elastic Load Balancers can’t be assigned an elastic IP, hence you must use a CName to give them a friendly URL. You can’t have a CName to a root URL. You must point the domain root 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, just redirect all domain root traffic (example.com) to a specific sub-domain (www.example.com).