How how do I use wildcard subdomains with WordPress multisite?

June 4, 2014 3.2k views
To start with I'd like to say that this is all new to me I am not a developer and I'm used to working with managed servers but like the idea of a faster server and paying by the month. I have spent all day just getting this far so any help anyone can give me is appreciated. So far I have installed WordPress by following the directions at This is working correctly. I can access and edit my files using and successfully activated multisites using subdomains. I created a CNAME record using an asterisk thinking thinking this would create a wildcard subdomain then tried to create child blog/site through WordPress. This is not working. So I created an A record using test3 as the hostname and the ip as the ip thing this would create a subdomain which still didn't work when I created a new child site in Wordpress. It took me all day to figure out how to get into developer mode on my Chromebook. I managed to create ssh keys to connect securely from my Chromebook to my droplet server and from to the server. Beyond this I am not comfortable using the command prompt. It seems that there are a great many of tutorials but they seem to all be geared towards experienced users. If someone knows of a easy to follow step by step tutorial on how to create wildcard subdomains for WordPress Multisite I would appreciate the link.
2 Answers
The wildcard CNAME record is fine (and required). After you've added that, you will need to configure Apache to serve your Wordpress instance for all subdomains under your domain.
Edit /etc/apache2/apache2.conf, find the section that says ServerAlias and append * to it. Finally, restart Apache (sudo service apache2 restart).
  • Thanks! This helped me out too!

  • This helped me out too. Thanks :-)

  • Hej Kamaln7 — Where do we need to add the line:

    ServerAlias *

    I can't find anything similar in /etc/apache2/apache2.conf

    Thanks for any feedback. I'm a bit lost here with the setting up of a WP Multisite, and relative wildcards :-/

    ps. I find something similar in /etc/apache2/sites-available/000-default.conf though. Unfortunately even if I've added the line you recommended, it still doesn't work.

     <VirtualHost *:80>
        ServerAlias *
        DocumentRoot /var/www/html
        <Directory /var/www/html/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
Thank you for your response. I guess it did work after all because I didn't do anything more and it is working now. I guess I just didn't give it enough time to propagate. Thank you.
Have another answer? Share your knowledge.