httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Günter Hipler <vogese...@gmail.com>
Subject [users@httpd] Re: mod_rewrite in conjunction with mod_jk
Date Tue, 04 Dec 2012 07:54:39 GMT
Hi

I solved it by myself - catching a glimpse through a book and sleeping a
night...

a) not used backreferences in RewriteRule
-> I used the wrong syntax for backreferences $1 instead of %1 for
backreferences to RewriteCond
b) no activation of RewriteRule within a more general container as .htaccess
-> For my use case I had to use the Location container instead of the
Directory or server context

Sorry for the trash and best wishes

Günter


*****

Hi,

I have to rewrite the URL:
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=-1+%3D+%22xml%22+IN+[4]&v=nose&l=de

which should be shortened and afterwords look like this
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=-1+%3D+%22xml%22&v=nose&l=de
(without the IN+[4] part)

I used the following condition/Rule (in .htaccess):

RewriteCond %{REQUEST_URI} ^/TouchPoint/perma\.do
RewriteCond %{QUERY_STRING} q=(.*?)(IN.*?)&v=(.*?)
#RewriteRule ^.*$ http://www.woz.ch?q=$1&v=$3 [NE,R=301]
RewriteRule ^.*$
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=$1&v=$3 [NE,R=301]

which rewrites the request to:
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=&v=
As a result, the backreferences are not used in the RewriteRule

My first question: Why?


On my way I had to learn, that .htaccess is the last trigger in the apache
chain and mod_jk is used before.  JKMount directives are processed before
the rules in .htaccess.

Now I have the problem, that using the rule above in the Directory context
it is never fired. I don't understand why...

<Directory "/srv/www/htdocs">
        Options None
        AllowOverride All
        Order allow,deny
        Allow from all
        Options FollowSymLinks
      RewriteEngine On

RewriteCond %{REQUEST_URI} ^/TouchPoint/perma\.do
RewriteCond %{QUERY_STRING} q=(.*?)(IN.*?)&v=(.*?)
RewriteRule ^.*$
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=$1&v=$3 [NE,R=301]


</Directory>


As a result
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=-1+%3D+%22xml%22&v=nose&l=de
isn't rewrited to
http://sb-tp1t.swissbib.unibas.ch/TouchPoint/perma.do?q=&v=
(as it is in .htaccess)

I don't understand why...

Thanks for any hint!

Günter Hipler

Mime
View raw message