[FX.php List] [OFF] Rewrite for forcing http to https possible?

biscuit technologies biscuit.tech at gmail.com
Tue Sep 23 17:25:51 MDT 2008


Hi Troy,
I think if you are using Apache 2.2.7 you can add the [B] option to
escape backreferences:
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html

- David

On Tue, Sep 23, 2008 at 9:23 AM, Troy Meyers <tcmeyers at troymeyers.com> wrote:
> This has worked very well, and we've had the new SSL Mini running for a couple of days.
>
> Only one issue has cropped up. Luckily it only affects some old and rare links that people have out there. It involves the rewrite rule that we have in the .htaccess file at the root level of the web stuff (the /Library/WebServer/Documents/.htaccess file).
>
> The rule that causes http URLs to be converted to https URLs is this:
>
> RewriteEngine On
> RewriteCond %{HTTPS} off
> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
>
> Some other rules follow, but supposedly the L causes no further rules to be tried.
>
> The problem is this...
>
> While these examples work fine:
>
> http://lab.troymeyers.com/
> becomes
> https://lab.troymeyers.com/
>
> http://lab.troymeyers.com/flasking/listing.php?genus=Coryanthes
> becomes
> https://lab.troymeyers.com/flasking/listing.php?genus=Coryanthes
>
> http://lab.troymeyers.com/flasking/file%20name%20with%20spaces.php
> becomes
> https://lab.troymeyers.com/flasking/file%20name%20with%20spaces.php
>
>
> ...this does NOT work well:
> http://lab.troymeyers.com/flasking/listing.php?genus=Name%20with%20spaces
> becomes
> https://lab.troymeyers.com/flasking/listing.php?genus=Name%2520with%2520spaces
>
> To clarify the problem, if the portion of a URL after the "?" has a character that seems like it ought to be encoded (if it weren't already URL encoded) it does it, even though it already IS encoded. Thus, the "%20" turns into "%2520". Note that is does NOT happen before the "?" character in the URL. In CDML-type URLs this produces missing field or file errors, since the names are messed up.
>
> Any ideas how the RewriteRule should be changed to fix this?
>
> -Troy
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>


More information about the FX.php_List mailing list