On Jan 4, 2011, at 10:22 AM, Jeff Poling wrote:

> I am very new to apache configuration, having inherited responsibility for it 
> this fall.  I need some assistance with (hopefully) a simple rewrite rule.
> 
> We are using apache in a reverse proxy configuration.  For a URL like:
> 
> http://www.mydomain.com/site/test
> 
> I want to rewrite it as https://www.mydomain.com/site/test
> 
> The trick is that "site" could be any number of different strings.  What 
> regular expression do I need to use to make this work?

If it's a fixed list, something like this should work:

RewriteCond %{HTTPS} !=on
RewriteRule "^(/(site|foo|bar|baz)/test.*)$" "https://%{HTTP_HOST}$1"; [NC,R,L]

Or, for /<anything>/test:

RewriteCond %{HTTPS} !=on
RewriteRule "^(/[^/]+/test.*)$" "https://%{HTTP_HOST}$1"; [NC,R,L]


---------------------------------------------------------------------
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: [email protected]
   "   from the digest: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to