After much hassle with the server move and general domain crappiness, I took an hour out today to see if I could remember how to do the old wildcard domain trick that I employed to offer the free subdomain / free url redirection site, all those moons ago. I really should have saved the info, because it would have saved me several server restarts, amongst other things.
In the end (and I’m putting this here as a note to myself as well) it boiled down to changes in just two files: Firstly, the wildcard DNS entry in /var/named/chroot/var/named/db.domain.com.include:
*.domain.com. in a 188.8.131.52 *.domain.com. in mx 20 domain.com
And then in /etc/httpd/conf/vhosts/siteX.include (where X is your site no.)
RewriteEngine off ServerAlias *.domain.com
Reboot the server (you might get away with just restarting Apache) and all’s well – you can type any hostname your want for domain.com and it’ll both resolve to the server IP and load the files from the root www host.
These instructions are for CentOS / Blue Quartz machines – your mileage may vary. I’ve reinstalled the database files and I’ll be uploading the actual website later tonight, so all those domains will be back on again shortly.
Originally Posted: 19th May 2006