How to Point a Sub-Domain to a Bind Folder
In most cases, domains and sub domains point to the main index page of a website. Webmasters can instead redirect their sub domains to arrive at a specific folder of the webmaster’s choosing, using the BIND DNS server. With the use of a “301 Permanent Redirect,” the sub domain “subdomain.example.com/folder” behaves as “subdomain.example.com.” Making the change is pretty straightforward and should take less than 10 minutes to complete successfully.
Instructions
-
-
1
Open a telnet connection to your Web server via the command prompt window. Enter “vi /var/user/example.com.db” and press “Enter” to edit the file in the VIM editor.
-
2
Add “*.example.com. 14400 IN A,” followed by your shared IP address at the end of the file. Save the file when finished. Enter “/etc/init.d/user restart” and restart “BIND.”
-
-
3
Open the “httpd.conf” file located on your Web server in a text editor. Copy the following into the file:
<VirtualHost [IP address]>
DocumentRoot /home/user/public_html
BytesLog domlogs/example.com-bytes_log
ServerAlias *.example.com
ServerName www.example.com
CustomLog domlogs/example.com combined
RedirectMatch 301 (.*) http://example.com$1
</VirtualHost>Save the file and upload it to the Web server via FTP client.
-
1