httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Martens <>
Subject [users@httpd] How to redirect a url to https?
Date Tue, 06 Dec 2005 21:46:26 GMT
Ok,  I've been scratching my head for a couple days now over something
that is probably very simple, but I can't seem to get to work.  What I
want to do is redirect all requests to a particular resource like to  Sounds
simple enough, but I just haven't been able to make it work.  If
possible, I want to have the configuration options in an external file,
then be able to include that file in both my :80 and :443 servers.  Then
apache would just Do The Right Thing(tm) and I would be happy... :)

Here is what I have tried (note, I have to use Location, because this is
a proxied path, and not a local directory).
<Location /somepath/ >
   RewriteEngine        on
   RewriteBase          /somepath
   RewriteCond          %{HTTPS} !=on
   RewriteCond          %{REQUEST_URI} ^/somepath/.*
   RewriteRule          /somepath/(.*)  \$1 [R=Permanent,L]
   ... authentication stuff ...
   require valid-user
ProxyPass /somepath/

But for whatever reason, when i try to access /somepath/, it lets me
authenticate without ssl, and never redirects me.

I've also tried something like this:
<IfModule !mod_ssl.c>
   RewriteEngine        on
   RewriteCond          %{REQUEST_URI} ^/somepath/.*
   RewriteRule          /somepath/(.*)$1 [R=Permanent,L]
<IfModule mod_ssl.c>
   <Location /somepath/ >
      ... authentication stuff ...
      require valid-user
   ProxyPass /somepath/

But for whatever reason, the authentication and <Location> stuff is showing 
up in my :80 server as well. Does that stuff get included in both virtual
hosts if mod_ssl is loaded?

Thanks for any suggestions.

Jason Martens

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