Question regarding Wildcard Subdomains and WordPress

roarkh

Verified User
Joined
Aug 30, 2005
Messages
141
Location
Bellingham, WA
I am attempting to get Wildcard Subdomains working with a WordPress site that has had the multi-site option enabled but seem to be missing something, the instructions I have been following are here...

http://help.directadmin.com/item.php?id=127

The site I have set up is for testing purposes only, I added a user to DirectAdmin creating a site similar to http://subdomain.domain.com. I then installed WordPress in the main public_html folder there with the multi-site option enabled.

Next I created an A record for the site containing just an * and the ip address of the site, that part is working fine, I can perform an nslookup on test.subdomain.domain.com, or test2.subdomain.com and the correct IP address is returned.

I then added the line "ServerAlias *.|subdomain.domain.com|" to the Apache configuration and that is where I seem to be getting stuck. With that entry in place I went ahead and created a new site in WordPress named "brian.subdomain.domain.com" but when visiting that site I always end up at the Apache is functioning normally page instead of the proper site.

However, if I add the line "ServerAlias brian.subdomain.domain.com" directly instead of "ServerAlias *.|subdomain.domain.com|" that works perfectly. If necessary I guess I can just add every site I want to set up in WordPress separately but it would be easier if I could get the wildcard working.

Can any one provide any insight as to why adding "ServerAlias *.|subdomain.domain.com|" to the Apache config might not be working when adding the sites directly (without the wildcard) does?

Thanks in advance.
 

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,255
Location
GMT +7.00
Hello,

Is it the exact code that you add:

Code:
[COLOR=#333333]ServerAlias *.|subdomain.domain.com|
?

that should be this way (if you use [/COLOR]subdomain.domain.com but not tokens):

Code:
[COLOR=#333333]ServerAlias *.subdomain.domain.com
[/COLOR]
 

userX

Verified User
Joined
Apr 28, 2020
Messages
17
I am trying to do the very same on a WP multisite

My setup is WP Multi-Network where the site in question is a root domain for sub-multisite on the multi-network, and the domain is set up in domain pointer using Cloudflare DNS.

No problem doing this in cPanel, is this limitation in DA or just plain error pointing to some kind of failure?


ServerAlias *.forum.domain.com

I hit save and I get this error:

Unable to write customization
AH00526: Syntax error on line 676 of /usr/local/directadmin/data/users/admin/httpd.conf:
ServerAlias only used in <VirtualHost>

Anyone know how to solve this issue?

Turn your multi-site installation of WordPress into many multi-site networks, all surrounding one central user base.
 
Top