Related to this question: What’s the point in having “www” in a URL?

How can I do a “www” redirection form a DNS record level? I don’t want to tweak apache or IIS to achieve this.

up vote 8 down vote accepted

Only through web server. DNS is not suitable if you want to domain redirection.

Domain redirection:

  • HTTP 3xx response
  • refresh meta tag
  • JavaScript redirects

All techniques use web server.

you cannot do redirection in DNS however you can define CNAME entry for www

Point to your "naked" domain record to 174.129.25.170 IP. It is free wwwizer.com service. More info at http://wwwizer.com/naked-domain-redirect.

If your web server is configured in meaningful way, you can just add two records that point to same server. Usually it's not important to have specific address in user's address bar (what is the difference if user sees www.example.com or example.com?).

As already answered, you can't redirect client on DNS level. In web server, you don't have to modify web server configuration, if both virtual hosts (with and without www) point to place where you can put your own scripts. For example, in PHP you can just write

Header("Location: http://example.com");

to redirect visitors to example.com (without www).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.