Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 ^(.*)$ https://www.mydomain.org/$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://www.mydomain.org/$1 [R=301,L]

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

migrated from stackoverflow.com Jul 16 '11 at 14:49

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

1 Answer 1

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

 
discard

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