Java Mailing List Archive

http://www.apache-httpd.com/

Home » users.httpd »

Re: [users@httpd] Possible to force SSL based on URL Variable?

Mike Soultanian

2008-07-09

Replies: Find Java Web Hosting

Author LoginPost Reply
Well, I think I kinda got it, but it doesn't seem to work right:

RewriteEngine On
RewriteCond %{QUERY_STRING} ssl=true [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

So, I would think that should search for anything after the path that
contains ssl=true and if it finds it, it will rewrite the URL with https
in front of it. However, it generates an error. Take a look:

https://gaggle.its.csulb.edu/itforums/index.php?ssl=true

take off the ssl=true and everything works fine:

https://gaggle.its.csulb.edu/itforums/index.php?

I don't get it because this is what I used before to force full-time SSL
and never had these issues:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

and the only thing I changed was the rewrite condition... errrrr...

any help would be much appreciated!!

Thanks!
Mike



Mike Soultanian wrote:
> Hey Everyone,
> I currently run phpbb and there is no facility to force SSL during
> logins only - it's only full-time SSL or not. Because I have to
> encrypt logins, I do the following in my .htaccess file:
>
> RewriteEngine On
> RewriteCond %{HTTPS} off
> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
>
> This essentially forces full-time SSL, which is kinda ok, but I'm
> running into weird phpbb quirks (SSL write delays) so I'd like to try
> and enable SSL only during logins.
>
>
> Since it is difficult to manipulate the protocol section of the URL in
> the phpBB code (http/https), I am thinking of appending a url variable
> whenever a user is redirected to the logon page that would look like
> this:
>
> https://mysite.com/forums/posting.php?mode=post&f=3&ssl=true
>
> And my hope was that I could have the rewrite mod look at the url and
> see if it contains ssl=true, and if so, force https.
>
> Seem doable? I would think searching a URL should be pretty simple,
> but I am not very well versed in regular expressions. I was hoping
> someone could help me write the rewrite condition to search for a string.
>
> Thanks!
> Mike
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@(protected)
>  "  from the digest: users-digest-unsubscribe@(protected)
> For additional commands, e-mail: users-help@(protected)
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@(protected)
 "  from the digest: users-digest-unsubscribe@(protected)
For additional commands, e-mail: users-help@(protected)

©2008 apache-httpd.com - Jax Systems, LLC, U.S.A.