Using mod_rewrite to force https in a .htaccess...
am 21.08.2002 21:02:24 von Sean M AldermanIs it possible to do this? Apache seems to be converting the URI from
an HTTP uri to a file uri before it parses the .htaccess file. We were
hoping to force https on individual directories where http
authentication is required, but we have so many of them we had hoped not
to need to do it in the server config. The rewrite section of my
..htaccess file looks like-
# Force clients from the Internet to use HTTPS
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule http://(.*) https://$1 [R]
But I get rewrite log entries have lines saying - applying pattern
'http://(.*)' to uri 'somedir/' - and I would expect them to be applying
the pattern to http://site.grc.nasa.gov/somedir/ instead.
Here's the rewrite log entries for a hit to the directory in question-
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#95048/initial] (3) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] add path-info postfix:
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/ ->
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#95048/initial] (3) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] strip per-dir prefix:
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/ -> somedir/
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#95048/initial] (3) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] applying pattern
'http://(.*)' to uri 'somedir/'
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#95048/initial] (1) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] pass through
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#97d48/initial/redir#1] (3) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] strip per-dir prefix:
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/index.php ->
somedir/index.php
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#97d48/initial/redir#1] (3) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] applying pattern
'http://(.*)' to uri 'somedir/index.php'
salderman.lerc.nasa.gov - - [21/Aug/2002:14:46:52 -0400]
[site.grc.nasa.gov/sid#41358][rid#97d48/initial/redir#1] (1) [per-dir
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/] pass through
/usr/appl/www/site.grc.nasa.gov/htdocs/somedir/index.php
Thanks.
--
Sean M. Alderman
ITRACK Systems Analyst
PACE/NCI - NASA Glenn Research Center
(216) 433-2795
Calling a windowed operating system "Windows" is like naming an
automobile "Wheels."
____________________________________________________________ __________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List modssl-users@modssl.org
Automated List Manager majordomo@modssl.org