|
Home > Archive > Apache Server configuration support > November 2006 > Redirecting HTTPS to HTTP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Redirecting HTTPS to HTTP
|
|
|
| Hello all,
The company I work for used to have their website accessible on both
HTTP and HTTPS. We've moved servers from the original host. It's come
to our attention that some people are linking to HTTPS pages and these
are now dead links.
I've set up a test server in the office with the latest version of
Fedora 6, and have been testing out a suggested solution from a search
on Google, using .htaccess:
RewriteEngine On
RewriteCond %{SERVER_PORT} ^443$
RewriteRule (.*) http://%{SERVER_NAME}/$1 [R=301,L]
This should, in theory, forward any requests using HTTPS (port 443) to
the HTTP address. What actually happens is I get a few "invalid
certificate" messages, and then it shows the page on HTTPS!
If this makes sense, and anyone has any idea what I might be doing
wrong, I'd appreciate some help on the matter 
Thanks!
Paul
| |
| devon_banks@comcast.net 2006-11-28, 7:28 pm |
|
Paul wrote:
> Hello all,
>
> The company I work for used to have their website accessible on both
> HTTP and HTTPS. We've moved servers from the original host. It's come
> to our attention that some people are linking to HTTPS pages and these
> are now dead links.
>
> I've set up a test server in the office with the latest version of
> Fedora 6, and have been testing out a suggested solution from a search
> on Google, using .htaccess:
>
> RewriteEngine On
> RewriteCond %{SERVER_PORT} ^443$
> RewriteRule (.*) http://%{SERVER_NAME}/$1 [R=301,L]
>
> This should, in theory, forward any requests using HTTPS (port 443) to
> the HTTP address. What actually happens is I get a few "invalid
> certificate" messages, and then it shows the page on HTTPS!
>
> If this makes sense, and anyone has any idea what I might be doing
> wrong, I'd appreciate some help on the matter 
>
> Thanks!
>
> Paul
I get the jist of what you are trying to do here but I'm not suer why
this is not working. The other thing you might try if you have php is
a using virtual host.
For
in ssl.conf
<Virtual Host _default_:443>
DocumentRoot "/var/www/html/sslusers"
ServerName www.example.com:443
### The other stuff that goes in here
###
</Virtual Host>
in httpd.conf
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /var/www/html ## whatever your current root file
location is
ServerName www..example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
in /var/www/html/sslusers directory place index.php
file contents
-------------------------------------------------
<?php
header("location:http://www.example.com")
?>
--------------------------------------------------------------
Or you could put an html page telling them the link has changed.
Not as gracefull as your solution, but it might work.
If someone does find out how do make the Rewrite work I hope they post
it.
I have the reverse problem. I have a 3 sub-domains which I need to
make sure are only accessed via SSL on one machine, I've never set up
multiple SSL domains on one machine or a strictly SSL machine. And on
another machine which have access to one domain via https and another
by http.
This Iater I think I can deal with the former I'm going to have to do
some testing and ask some questions.
|
|
|
|
|