The web hosting publication by web hosting users for web hosting users
Update a Host / Editor Login
Search
Article News Host Business Name
DIRECTORY TOP RATING EDITOR REVIEW FORUM SEARCH HOSTING SHOWCASE BECOME AN EDITOR
RECENT NEWS
The Evolution of the IT Specialist
ICANN Decides To Expand Internet
Pingdom Adds Business Monitoring Plan
Apptix Offers Hosted VoIP Products
ARTICLES
Co-location Hosting
Dedicated Servers
Domain Names
E-Commerce / Merchant Accounts / Payment Gateways
Free Web Hosting
General Web Hosting
Hosting Software & Control Panels
Managed Web Hosting
Programming
Reseller Hosting
Running a Web Hosting Business
Search Engine Optimization
Specific Web Hosting Provider or Company
Technical & Security
Useful Website Tools
Virtual Private Servers
Web Design & Content
Website Marketing Campaign
SEARCH ARTICLES
WEBHOST DIRECTORY
By Location


By Category
Application Hosting
Collocation Hosting
Dedicated Servers
Domain Name Registration
Ecommerce Hosting
Free Web Hosting
Reseller Domain Name Registration
Reseller Hosting
Shared Web Hosting
Virtual Private Servers
By Function
Windows Web hosting
PHP Web Hosting
Mysql Web Hosting
ASP Web Hosting
MS SQL Server Web Hosting
Coldfusion Web Hosting
MS FrontPage Web Hosting
Ecommerce Web Hosting
Cheap/Discount Web Hosting
Personal Web Hosting
Domain Name Web Hosting
A-Z Listing
Enter web host domain:




Articles
  You are here : Home » Articles » Domain Names
Supporting http://mydomain.com (a How-to)
Submitted by Jessica Conelly on | 263 reads

Supporting http://mydomain.com (a How-to)

This HOWTO configures a DNS server to allow URL's of the form http://www.mydomain.com and http://mydomain.com - both URL's will get to the same web server. Seems it’s the cool thing to do these days.

Note: You will also have to change your web server for this to work (change defined below for Apache using Virtual hosts).

; zone fragment for 'zone name' mydomain.com
....
; SOA NS MX and other stuff
; define an IP that will resolve mydomain.com
                 IN      A      192.168.0.3
; you could also write the above line as 
; mydomain.com.  IN      A      192.168.0.3
www              IN      CNAME  mydomain.com. ; dot essential
; aliases www.mydomain.com to mydomain.com
; OR define another A record for www using same host
; this is the least number of changes and saves a CNAME
www              IN      A      192.168.0.3

You could do the above for any other host name e.g. ftp as long as different ports are in use e.g. ftp://example.com would work if your FTP server was appropriately configured and on the same host!

Apache change

Assuming you are using virtual hosts on an Apache server you will have a definition in your httpd.conf file something like this:

<VirtualHost 10.10.0.23>

    ServerAdmin webmaster@mydomain.com

    DocumentRoot /path/to/web/root

    ServerName www.mydomain.com

    ErrorLog logs/error_log

    CustomLog logs/access_log common

</VirtualHost>

You need add a second definition with ServerName modified to reflect your change as follows:

 

<VirtualHost 10.10.0.23>

    ServerAdmin webmaster@mydomain.com

    DocumentRoot /path/to/web/root

    ServerName mydomain.com

    ErrorLog logs/error_log

    CustomLog logs/access_log common

</VirtualHost>

 

An alternate method is to use a single <VirtualHost> with the ServerAlias directive as shown below:

 

<VirtualHost 10.10.0.23>

    ServerAdmin webmaster@mydomain.com

    DocumentRoot /path/to/web/root

    ServerName www.mydomain.com

    ServerAlias mydomain.com

    ErrorLog logs/error_log

    CustomLog logs/access_log common

</VirtualHost>

 

Notes:

  1. In many cases when you type example.com in your browser, the ever helpful browser will auto-complete (or guess) that what you really meant was www.example.com and add the www. So after all that hard work in many browsers example.com would have worked even if you had done nothing!

 

  1. If you are using MS Frontpage extensions with a single <VirtualHost> definition then the ServerName must be the name that is used to login to FP. In the example above the FrontPage login name used would be www.mydomain.com. When using FP if the ServerName were example.com and the ServerAlias were www.mydomain.com then the FP login would fail.


ARTICLES | NEWS | DIRECTORY | TOP REVIEWS| TOP RATINGS| FORUM | SEARCH | SHOWCASE | UPDATE A HOST
OUR EDITORS | CONTACT US | ADVERTISING | TERMS OF AGREEMENT
© Copyright 2006 , The Web Hosting Herald. All rights reserved.