I have three separate domains in Route 53:
- domain1.com
- domain2.com
- domain3.com
They all have an A record that points to the same IP address. In addition, they have a CNAME record that points to their respective A records.
Recently I removed the record for domain1.com. (I don't want users to browse the site via that URL while I am working on it).
However, when I try to browse domain2.com (or domain3, for that matter), I get a 301 response, redirecting me to domain1.com. Since the A record for domain1 no longer exists, I get a "server not found" response.
This happens when I try to browse the IP address directly too, even from a device which has not browsed any of the three domains before.
Why is this so? And what can I do about it?
The site runs wordpress. Evidently, if wordpress receives a request from a non-default domain (e.g. domain2), it issues a 301 to the default domain (i.e. domain1). This was the problem.