I’ve been researching, trying and pulling out my hair for a week and I can’t seem to find the solution to this issue and was hoping for some help.
The short story…
I created a CMS for my clients. In the past I had to upload any code changes to all the domains using that CMS. I have made some small changes to the code so that all my clients can be served by one instance of the CMS to lessen my work load so I can spend less time uploading changes and spend more time with my 2 baby girls.
So far aside from a couple of little bugs that need to be ironed out, it works, however you can only reach the site by using a dynamic subdomain. I would like to be able to use the “real” domain name.
I am not aware whether anyone has figured out how to create “wildcard” subdomains so this is the story: Each subdomain is effectively another domain on the Internet. They are typically “rooted” in a subdirectory of the main domain but that is NOT required - they may be on entirely different servers with dissimilar IP addresses. Because of that, your dynamic (my “wildcard”) subdomains are not possible.
Of course, if anyone knows of a “wildcard” subdomain solution, I’d love to hear about it!
Perhaps I have the term wrong but I have a A record on my web server DNS for *.publishpixel.com. Jeffsanders.publishpixel.com does not exist as a “real” subdomain on the server. When someone comes to the site it checks a database of registered clients and serves the correct database for that fake subdomain.
As I mentioned. The wildcard subdomain works. If you try foo.publishpixel.com you will get an error message. I would just like to use a real internic domain to point to it.
From my reading of that (and a few other pages from Google-listed “A record subdomain wildcard”), I would discount the one who recommended changing the namecheap DNS pointers and simply manage your DNS records via WHM/cPanel. That should work for you to access your main domain as well as your wildcard subdomains.
Additionally, if done via DNS records (on your production server), the A records will not impact the MX records (you’ll have to duplicate the wildcard creation there if you want to have e-mail for your wildcard subdomains, too) so that part of your question would be covered, too.
WARNING: I’m not sure how your CMS is setup to handle non-existent accounts (subdomains) so you may want to have it check for the account then redirect to a “garbage handler” if the account doesn’t exist (be sure to standardize your capitalization OR build a safeguard into your query creation). This could be a problem because domain names (including subdomains) are NOT case sensitive but your database and file structure is (on 'nix systems) so mixing cases could cause a problem.
THANK YOU for posting the wildcard subdomain information.