httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Martens <jmart...@cityofevanston.org>
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
http://www.example.com/somepath to https://example.com/somepath.  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/(.*)  \
https://www.example.com/somepath/$1 [R=Permanent,L]
   ... authentication stuff ...
   require valid-user
</Location>
ProxyPass /somepath/       http://otherhost.example.com/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/(.*) https://www.example.com/somepath/$1 [R=Permanent,L]
</IfModule>
<IfModule mod_ssl.c>
   <Location /somepath/ >
      ... authentication stuff ...
      require valid-user
   </Location>
   ProxyPass /somepath/       http://otherhost.example.com/somepath/
</IfModule>

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:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message