0

I'm having configuration issues with my website, and I'm even more confused now that I've been looking for solutions. My DNS table looks as follows:

A       @       12.34.12.34   600 seconds
CNAME   www     @             1 Hour

Currently both mydomain.tld and www.mydomain.tld work, but I would like all the queries to mydomain.tld to be redirected to www.mydomain.tld

Is there any way to do it from the DNS table or the .htaccess, or do have to code a 301 redirection as mentioned here : A record for www ?

Could I just use "www" as an A record and @ as a CNAME ?

Thanks

user1319182
  • 141
  • 7
  • You can not use a `CNAME` at the apex (i.e. for `example.com`). You can point it at 205.178.189.129 (hosted by Network Solutions) or WWWizer (http://wwwizer.com/) if you don't want to bother setting up the redirect. – ceejayoz Aug 25 '17 at 21:49

1 Answers1

1

The redirect you want to setup is granted from a web server configuration; you even cited 301 as a HTTP status code, that you shall use on your webserver setup.

Trying to swap DNS zone record just won't bring any redirect: the value will reference the same webserver address, but the key player is the different value for Host: header in your two different HTTP requests:

  1. Host: mydomain.tld

  2. Host: www.mydomain.tld

So you have to configure a redirect in your webserver for mydomain.tld

alessio
  • 136
  • 1
  • 5