I want to add an entry for a website name to be redireected to another website. So I added the entry in the etc/hosts file. For example, let Google's IP is and I want to example.com to be resolved to Google's IP. so I added: example.com

But this is totally ignored. When I enter example.com in an updated Chrome browser, the browser goes to example.com and ignores the hosts entry for example.com.

The experiment is successful in my own PC but does not work in my Amazon EC2 instant.

Can you explain why etc/hosts entry is ignored by my Amazon EC2 instant? How to fix this issue please?

1 Answer 1


You've entered them in reverse. The IP address must come first, then the host names.

For example: example.com www.example.com

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.