View Full Version : Wildcard DNS
csite
04-03-2007, 08:46 PM
Is there anyway to use Wildcard DNS with a VPS?
I have all these old sub domains indexed with google, but when you go to them you get a page cannot be displayed. I think wildcard DNS would allow me to forward those sub-domains that dont exist to an existing page...
Am I correct?
Thanks un advance.
Yes this can be done. If you are using Gate.com for your DNS then you will need to contact them and request that they set up the wildcard in the zone file.
inc595
08-14-2007, 04:09 AM
After you have DNS pointing to your IP, log into your server as root via SSH.
Edit this file:
/var/www/vhosts/domain.tld/conf/vhost.conf
Add this to the file
ServerAlias *.domain.tld
In order for the new files to take effect you should rebuild Apache configuration with the following command:
/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=<domain.tld>
Now your site should come up at what ever subdomain resolves to it. You probably want everyone to get to the proper domain name. Also for better google ranks a 301 redirect for multiple domains of the same site is recommended. Create an .htaccess file and put it in your httpdocs folder. This rule should re-write everything to the www domain.
RewriteCond %{HTTP_HOST} ^domain.tld [NC]
RewriteRule ^(.*)$ http://www.domain.tld/$1 [L,R=301]
vBulletin v3.5.1, Copyright ©2000-2008, Jelsoft Enterprises Ltd.