On Fri, Jul 14, 2000, Carrie Coy wrote:
> I'm successfully rewriting specific http->https URLs using some code
> suggested by Ralf Engleschall (see below). Now I'm trying to modify
> RewriteCond to avoid the need to have multiple entries in my map file for
> entries like these:
>
> my.cgi
> my.cgi/response
>
> I want to pass either REQUEST_FILENAME or SCRIPT_FILENAME to the map instead
> of the URI, but both pass the URI as the key, in spite of their names.
>
> I looked at mod_rewrite.c and I can see that this happens because of the
> following code:
>
> /* if filename was not initially set,
> * we start with the requested URI
> */
> if (r->filename == NULL)
>
> r->filename = ap_pstrdup(r->pool, r->uri);
> rewritelog(r, 2, "init rewrite engine with requested uri %s",
> r->filename);
> }
>
> That's the extent of my insight. Why haven't I set filename and how might
> I do this?
r->filename will usually be never set, i.e., the above code is usually always
executed. At least as long as mod_rewrite comes first in the processing (and
mod_alias, mod_userdir, etc. next). So, I'm currently still not understanding
what your problem is. You can lookup arbitrary keys with ${xxx} and because
xxx can be $N, just adjust your regular expressions.
> RewriteEngine on
> RewriteLog "/usr/local/apache/logs/rewrite.log"
> RewriteLogLevel 5
> RewriteMap https-map txt:/usr/local/apache/conf/secure.map
> RewriteCond %{SERVER_PORT} =80
> RewriteCond ${https-map:%{REQUEST_FILENAME}|do-not-map} !=do-not-map
> RewriteRule ^(/.*)$ https://%{SERVER_NAME}/${https-map:$1} [R,L]
Your problem is just that you match the whole URL with ^(/.*)$ and you're
using the whole in %{REQUEST_FILENAME}. Instead you should strip away your
extensions in the regex and then use $1 both in the RewriteCond and
RewriteRule. Check the mod_rewrite.html documentation for details where $N is
available for expansion and you'll see what I talk about.
But keep in mind that all this has nothing to do with mod_ssl, so it is
off-topic on this mailing list, of course.
Ralf S. Engelschall
[EMAIL PROTECTED]
www.engelschall.com
______________________________________________________________________
Apache Interface to OpenSSL (mod_ssl) www.modssl.org
User Support Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]