httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Christophe Boggio <apa...@thefreecat.org>
Subject [users@httpd] Problem with URL Rewriting
Date Wed, 30 May 2012 13:39:14 GMT
Hello, I have a problem with URL Rewriting.

I'm trying to transform URLs of the form :

http://medecine-et-enfance.net/archives/voir.html?file=J_2005_01_039.pdf
to
http://medecine-et-enfance.net/showpdf.html?file=J_2005_01_039.pdf

I have defined the following in the VirtualHost :

         RewriteEngine   on

         RewriteLog      "/tmp/ecm3-rewrite.log"
         RewriteLogLevel 4

         RewriteCond     %{QUERY_STRING}                                 file=(.*)
         RewriteRule     ^/archives/voir.html                            /showpdf.html?file=%1
[L]

         RewriteRule     (^/data/pdf/.*)                                 /showpdf.html?file=$1
[L]

This last line is to address a different case where users could get the files directly
by requesting :
http://medecine-et-enfance.net/data/pdf/J_2005_01_039.pdf


Everything seems fine, if I look at the logs :

81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(2) init rewrite engine with requested uri /archives/voir.html
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(3) applying pattern '^/archives/voir.html' to uri '/archives/voir.html'
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(4) RewriteCond: input='file=/data/pdf/J_2005_01_039.pdf' pattern='file=(.*)' => matched
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(2) rewrite '/archives/voir.html' -> '/showpdf.html?file=/data/pdf/J_2005_01_039.pdf'
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(3) split uri=/showpdf.html?file=/data/pdf/J_2005_01_039.pdf -> uri=/showpdf.html, args=file=/data/pdf/J_2005_01_039.pdf
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(2) local path result: /showpdf.html
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(2) prefixed with document_root to /var/www/sites/ecm3/showpdf.html
81.56.192.64 - - [30/May/2012:14:48:51 +0200] [www.medecine-et-enfance.net/sid#7fd445aa0668][rid#7fd43f2f80a0/initial]
(1) go-ahead with /var/www/sites/ecm3/showpdf.html [OK]

But I have put a spy in /archives/voir.html to see if the page is still being called, and
it is :

==> /var/log/apache2/ecm/error.log <==
[Wed May 30 14:48:51 2012] [warn] [27627]ERR:  32:  Warning in Perl code: Acces a voir.html
non filtre ! at //var/www/sites/ecm3/archives/voir.html line 20, <GEN0> line 4.
[Wed May 30 14:48:51 2012] [warn] [27627]ERR:  32:  Warning in Perl code: showpdf: /data/pdf/J_2005_01_039.pdf
at /var/www/sites/ecm3/showpdf.html line 25, <GEN0> line 4.

The users still can get the files using voir.html (though showpdf.html seems to be called
?!)

Thanks for your help,

JC

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message