httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Boyle Owen" <>
Subject RE: [users@httpd] Redirecting Back to HTTP from HTTPS
Date Wed, 13 Jun 2007 07:18:31 GMT
> -----Original Message-----
> From: Don Don [] 
> Sent: Tuesday, June 12, 2007 4:56 PM
> To: Apache Mailing List
> Subject: [users@httpd] Redirecting Back to HTTP from HTTPS
> Redirect back to http from https
> I've set up my apache to redirect from 2 http pages to https 
> when requested which runs fine...the browser then keeps 
> running other pages on https, I need to be able to return to 
> normal http when those 2 pages are done with.
> I am using the following statements in apache2 in my virtual 
> hosts section
> Redirect /host/directory/folder/login.php 
> https://servername/host/directory/folder/login.php
> Redirect /host/directory/folder/register.php 
> https://servername/host/directory/folder/register.php
> What statements can I use to return back to http when the 
> avove 2 pages are not involved ?

You might have a bit of a misconception about how HTTPS works... You
seem to be thinking of it as a security feature that you can switch on
and off on a single site. It's not. It's more like you have two separate
websites and you have to switch between them. [eg, forget about HTTPS
and imagine you had to go to to log in but then the
main content was on].

You already know how to do half of it with your redirects from the HTTP
site to HTTPS. So you could set up a similar set of redirects in the
HTTPS site to take you back to HTTP - but you'd need one for ever URL
that leads to the HTTP site [I don't know your site - maybe that's
feasible.. but it wouldn't be a very general solution].

The general way to do this is to use mod_rewrite with skipping, eg:
(NB the "..." is for abbreviation, it's not literal)

RewriteRule /.../login.php https://.../login.php       [R]
RewriteRule /.../register.php https://.../register.php [R]

RewriteRule /.../login.php    - [S=2]
RewriteRule /.../register.php - [S=1]
RewriteRule ^/(.*) http://servername/$1 [R]

In the HTTP VH you just have what you have already but using mod_rewrite
instead of Redirect. In the HTTPS VH, if you get login.php or
register.php you don't rewrite it (the "-"), then you skip the next 2 or
1 RewriteRules ( [S=2], [S=1]) - that is, you skip over the general
purpose rewrite back to HTTP.

So login.php or register.php get served from HTTPS and everything else
goes back to HTTP.

- Don't know what your authentication mechanism will make of all this -
is a cookie delivered from the HTTPS site returned when you switch back
to HTTP?
- you might get browser complaints about mixing secure and non-secure

At the end of the day, is it a big problem if all the login content is

Owen Boyle
Disclaimer: Any disclaimer attached to this message may be ignored. 

> Cheers
> ________________________________
> Park yourself in front of a world of choices in alternative vehicles.
> Visit the Yahoo! Auto Green Center. 
> <*
> 3JlZW4tY2VudGVy> 
This message is for the named person's use only. It may contain confidential, proprietary
or legally privileged information. No confidentiality or privilege is waived or lost by any
mistransmission. If you receive this message in error, please notify the sender urgently and
then immediately delete the message and any copies of it from your system. Please also immediately
destroy any hardcopies of the message. You must not, directly or indirectly, use, disclose,
distribute, print, or copy any part of this message if you are not the intended recipient.
The sender's company reserves the right to monitor all e-mail communications through their
networks. Any views expressed in this message are those of the individual sender, except where
the message states otherwise and the sender is authorised to state them to be the views of
the sender's company.

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message