httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Riggs <apache-li...@riggs.me>
Subject Re: [users@httpd] Rewrite rules
Date Tue, 04 Jan 2011 16:52:47 GMT
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: 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