Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I'd like to have my system automatically take me to even if I put into my browser. I can get /etc/hosts to redirect to me to different domains, but it seems to ignore it if I put https:// into it.

This works, and it redirects to

This does not

My guess is that you can't use text at all in the part where the IP is, but how do I force it to use https? Is this possible in iptables?

share|improve this question
Since this question was asked, many website such as Facebook now redirect to https by default. – spuder Jan 20 '14 at 7:38

1 Answer 1

up vote 6 down vote accepted

No, it is not possible using iptables.

If you used it to redirect port 80 to port 443, your browser would still speak to it using http rather than https, and all you would get is garbage.

Maybe something using a Squid proxy would work. You could make it a transparent proxy if you can't change everyone's proxy settings.

Or, if it's just for Facebook, there is a new per-user setting to force HTTPS that might work for you when it is rolled out.

Or, if you're using Firefox, check out HTTPS Everywhere.

share|improve this answer
To further @Mikel's comments about why it wouldn't work: The browser is speaking HTTP to port 80. You'd need to somehow convince the browser that it visited a web server that returned a 302 status return, which would redirect the browser to the SSL page. – jsbillings Jan 28 '11 at 14:32
If you're using Firefox, you can also install the NoScript addon, which has a setting that allows you to force the use of HTTPS on whatever domains you specify. See for details. – ithcy Feb 15 '11 at 19:06

Your Answer


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

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