I’m trying to setup a temp WordPress environment to build a new website for a client, but I want to leave the old one in place until the last minute. The old site in up in AWS, new site is traditional hosting. I setup a hosts file so my computer would bypass the instruction to go to https, but I can’t get it to work without breaking the old site. It looks like I need to keep the listener rules in place for now, but can I modify one to let the hosts file work?

The listener rules are: HTTP 80 redirects *.site.com and site.com to port 443, and forwards all else to HTTPS through a target group. HTTP 443 rule just forwards to the Target group, with the (amazon issued) SSL cert specified

Is something here overriding my hosts file - which is telling my machine to point site.com and www.site.com to the IP address

  • Something to note: If you're using Firefox, they recently added DNS over HTTPS, which will bypass the hosts file. – ceejayoz Jan 13 at 18:16
  • 1
    "I setup a hosts file so my computer would bypass the instruction to go to https, but I can’t get it to work without breaking the old site." Everything here needs explaining, I'm afraid. How would a hosts file entry bypass an http to https redirect? In what way can you break the old site and subsequently get "it" (?) to work? What exactly doesn't work in your test environment, and how exactly does it fail (with what error message or result)? – Michael - sqlbot Jan 14 at 0:28

AWS has nothing to do with your local hosts file. Hosts files on EC2 instances work like regular hosts files, but I don't think that's relevant to your query.

In general, when you set a local hosts file entry then restart your PC / flush the DNS cache it will work as expected. Protocol doesn't matter. http, https, udp, etc, unless an application caches the IP address. When you say you've setup the hosts file to bypass https I wonder what you've done there.

Your approach is generally fine, something I've done myself. I tell the customer the old website is now read only, build the new site on the new host, get it working, then switch DNS. So the approach is fine.

This isn't a full answer to your question, but it was too long for a comment. If you want more help please edit your question (don't just comment) to tell us more precisely what you've done, and give us host names and IP addresses. You can edit them out of your question once you have an answer, and you can ask people not to include them in their answers.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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