Mailing List Archive

[Q] RewriteMap
Hi all,

it is the first time I'm trying to implement a RewriteMap, and although
I have some experience with regular expressions, something's going
wrong. Maybe some of you got the answer - so here's my prob:

apache 1.3.22 on Debian Linux 2.4.17

httpd.conf:

ServerName disp05
...
RewriteEngine On
RewriteLogLevel 4
RewriteLog /var/log/apache/disp05/rewrite_log

RewriteMap shortnames txt:/etc/apache/shortnames.txt
RewriteCond %{REQUEST_FILENAME} /\w+
RewriteRule (.*) ${shortnames:$1} [T=text/html,R=permanent,L]

As you may presume already, shortnames.txt looks like:
gesundheit http://disp05/app/jsp/categoryoverview_jsp/57285.html
hobby http://disp05/app/jsp/categoryoverview_jsp/85300.html
and so on

Now two strange things happen:
1. The RewriteCond doesn't match as it should do. For instance, if I
send a request for 'http://disp05/hobby' it doesn't match.
2. If I change the condition (to an expression that always matches)
applying the RewriteRule delivers 'http://disp05/' - which is absolutely
not what it should do.

Well, maybe all this happens just because it's friday, but nevertheless:
has anyone got an idea what's going wrong?

Many thanx in advance
Martin



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
Re: [Q] RewriteMap [ In reply to ]
Ok, forget about my post. mod_rewrite seems to be at least a little
buggy: doesn't understand \w, but [a-zA-Z0-9] instead...


Martin Haase-Thomas wrote:

> Hi all,
>
> it is the first time I'm trying to implement a RewriteMap, and
> although I have some experience with regular expressions, something's
> going wrong. Maybe some of you got the answer - so here's my prob:
>
> apache 1.3.22 on Debian Linux 2.4.17
>
> httpd.conf:
>
> ServerName disp05
> ...
> RewriteEngine On
> RewriteLogLevel 4
> RewriteLog /var/log/apache/disp05/rewrite_log
>
> RewriteMap shortnames txt:/etc/apache/shortnames.txt
> RewriteCond %{REQUEST_FILENAME} /\w+
> RewriteRule (.*) ${shortnames:$1} [T=text/html,R=permanent,L]
>
> As you may presume already, shortnames.txt looks like:
> gesundheit http://disp05/app/jsp/categoryoverview_jsp/57285.html
> hobby http://disp05/app/jsp/categoryoverview_jsp/85300.html
> and so on
>
> Now two strange things happen:
> 1. The RewriteCond doesn't match as it should do. For instance, if I
> send a request for 'http://disp05/hobby' it doesn't match.
> 2. If I change the condition (to an expression that always matches)
> applying the RewriteRule delivers 'http://disp05/' - which is
> absolutely not what it should do.
>
> Well, maybe all this happens just because it's friday, but nevertheless:
> has anyone got an idea what's going wrong?
>
> Many thanx in advance
> Martin
>
>
>
> ---------------------------------------------------------------------
> 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
> For additional commands, e-mail: users-help@httpd.apache.org
>
>



---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
RE: [Q] RewriteMap [ In reply to ]
> From: Martin Haase-Thomas [mailto:mht@meome-ag.de]

> Ok, forget about my post. mod_rewrite seems to be at least a little
> buggy: doesn't understand \w, but [a-zA-Z0-9] instead...

Not all regex libraries are the same. Apache 1.3 uses HSRegex or your
system regex library (egrep-style) not perl regex.

As for your original question, please start by using the RewriteLog with a
high RewriteLogLevel to help you debug.

Joshua.


---------------------------------------------------------------------
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
For additional commands, e-mail: users-help@httpd.apache.org
Re: [Q] RewriteMap [ In reply to ]
As I found out, apache doesn't tell much more with a loglevel higher than 4.
But thanx for the regex libs tip - I know them only from the perl side.

Martin


Joshua Slive wrote:

>>From: Martin Haase-Thomas [mailto:mht@meome-ag.de]
>>
>
>>Ok, forget about my post. mod_rewrite seems to be at least a little
>>buggy: doesn't understand \w, but [a-zA-Z0-9] instead...
>>
>
>Not all regex libraries are the same. Apache 1.3 uses HSRegex or your
>system regex library (egrep-style) not perl regex.
>
>As for your original question, please start by using the RewriteLog with a
>high RewriteLogLevel to help you debug.
>
>Joshua.
>
>
>---------------------------------------------------------------------
>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
>For additional commands, e-mail: users-help@httpd.apache.org
>
>