Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I edited /etc/hosts file and entered below information :  //working //not working . 

from the above info, is redirecting to, but is not redirecting to . Is there any way I can do that?

share|improve this question

migrated from Aug 2 '12 at 13:59

This question came from our site for professional and enthusiast programmers.

I've got the same issue. Have you solved? –  sensorario Aug 17 '13 at 6:02

2 Answers 2

/etc/hosts does not care about protocols, it handles host names. Moreover, // is not a comment character in /etc/hosts. See

man hosts

for details.

should be enough for redirecting both http and https. Do you run a service listening for https connections on your localhost?

share|improve this answer
leave those commnents, i just entered them here . My use case is,in my website some parts of the code can be tested only with the domain name, and my website uses https . So, if it is just http, i can test locally with the domain name . But as it is https, I am unable to test locally . –  user1506361 Aug 2 '12 at 13:43
Once more: Is your local webserver configured to handle https requests? –  choroba Aug 2 '12 at 13:48

I thought I was having a similar problem.

For anyone who makes the same silly mistake I did...

I was testing a new webserver by rerouting the requests to a different IP by /etc/hosts.

I did tail -f access_log on my web server and saw all my test requests, except the https ones. I spent a few minutes trying to figure that out.

Finally, I realized that I log SSL requests to a different file. Those log entries were working just fine, in access_ssl_log. Doh!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.