1

What is the setting I need to do to make the website work as domainname.com and www.domainname.com

Thanks Jean

0

4 Answers 4

3

You need to add a www DNS record. I would read this article.

1
  • + eventually routing the request to the same folder / document-root
    – akira
    Jun 17, 2010 at 14:44
1

Using example.com as an example:

  1. Insert A records for www.example.com and for example.com in your DNS configuration, both to contain the IP address of your web server

  2. Configure your web server to redirect example.com to www.example.com.

The latter is preferable to just having both sites serve the same document root, because then cookies will work more reliably.

1
  • 3
    Somewhat off topic, but 2. is not exactly trivial when you have an https canonical url and want to avoid certificate errors.
    – mika
    Jun 21, 2010 at 7:50
0

The best practices way to do this in most cases is 2 DNS records. One 'A' Record for the root (example.com) and one CNAME for the www prefix (www.example.com).

The only time you would use a redirect would be if you wanted force the URL to always display one address (i.e. always show www.example.com even if they type in just example.com or vice versa)

0

Read the following site for detail on CNAME.

http://www.zytrax.com/books/dns/ch8/cname.html

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .