Re: mod_rewrite in conjunction with mod_jk
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
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
[Index of Archives]
[Open SSH Users]
[Linux ACPI]
[Linux Kernel]
[Linux Laptop]
[Kernel Newbies]
[Security]
[Netfilter]
[Bugtraq]
[Squid]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Samba]
[Video 4 Linux]
[Device Mapper]