Thread URL auf Querystring abbilden (1 answers)
Opened by GwenDragon at 2019-10-01 12:56

GwenDragon
 2019-10-01 12:56
#190604 #190604
User since
2005-01-17
14533 Artikel
Admin1
[Homepage]
user image
Ich versuche mittels internem Apache-Rewrite eine URL so umzusetzen, dass das empfangende Skript eine Query bekommt.

.htaccess
Code: (dl )
1
2
3
4
RewriteEngine On
RewriteBase /
RewriteRule ^ttt/tags$ /cgi-bin/t1.pl [L]
RewriteRule ^ttt/tags/(.*) /cgi-bin/t1.pl?-tags=$1 [L]


Mein Testscript:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl

use 5.010;
use strict;
use warnings;

print "Content-Type: text/plain\n\n";

say qq{ENV REQUEST_URI  = $ENV{REQUEST_URI}};
say qq{ENV QUERY_STRING = $ENV{QUERY_STRING}};

use CGI::Simple;
my $c = CGI::Simple->new;
say "\nCGI-Modul:";
say $c->query_string(); 
say $c->param('-tags');


Aufruf von /ttt/tags?-tags=test%26More,A,C%26A ergibt:
Code: (dl )
1
2
3
4
5
6
ENV REQUEST_URI  = /ttt/tags?-tags=test%26More,A,C%26A
ENV QUERY_STRING = -tags=test%26More,A,C%26A

CGI-Modul:
-tags=test%26More%2CA%2CC%26A
test&More,A,C&A
Wie erwünscht ist der Parameter -tags ok.




Aufruf von /ttt/tags/test%26More,A,C%26A egribt:
Code: (dl )
1
2
3
4
5
6
ENV REQUEST_URI  = /ttt/tags/test%26More,A,C%26A
ENV QUERY_STRING = -tags=test&More,A,C&A

CGI-Modul:
-tags=test&More%2CA%2CC=&A=
test


Irgendeine Idee was das Modul veranlasst, das erste %26 fälschlich zu ersetzen?
Last edited: 2019-10-02 11:43:24 +0200 (CEST)
die Drachin, Gwendolyn


Unterschiedliche Perl-Versionen auf Windows (fast wie perlbrew) • Meine Perl-Artikel

View full thread URL auf Querystring abbilden