Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I access my site through https, Firefox asks to allow my webhost's certificate and then I get redirected to my webhost's index page.

I have not asked my webhost to provide me with https so I would like any request to https be redirected to http. I have tried these different methods but Firefox still asks for certificate approval and then get redirected to my webhost's index page. My webhost has Mod_rewrite enabled (apache 2.2) but these lines do not work :

How can I redirect to my website rather than to my webhost's ? (Ports 80 and 443 are open.)

RewriteCond %{HTTPS} on
RewriteRule ^(.*)$$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$$1 [R=301,L]

RewriteCond %{SERVER_PORT} 443 
RewriteRule ^(.*)$$1 [R=301,L]
share|improve this question

migrated from Jul 16 '11 at 14:49

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

up vote 2 down vote accepted

That is not going to work, I'm afraid :(

Secure channel (SSL) has to be fully established BEFORE HTTP part of HTTPS gets involved.

In other words, you cannot rewrite it like that without establishing a secure connection first. In your situation it will always ask you to accept webhost's certificate before any of such rewrite rule will have a chance to start.

You need proper (your own) SSL certificate .. or another hosting company (that will not have HTTPS at all).

share|improve this answer

Your Answer


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