httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moritz Lennert <mlenn...@club.worldonline.be>
Subject [users@httpd] rewrite and internal redirects
Date Tue, 29 Apr 2014 11:44:41 GMT
Hello,

I've been going crazy over this problem and even though I've seen
mentions of similar issues on this mailing list and elsewhere, I've just
not been able to apply the recipes there to solve my issue.

I have the following setup of a virtual host:

<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   ServerName example.com

   DocumentRoot /home/geogf405/qgis-web-client/site
   <Directory />
     Options FollowSymLinks
     AllowOverride None
   </Directory>
   <Directory /home/geogf405/qgis-web-client/site/>
     Options Indexes FollowSymLinks MultiViews
     AllowOverride None
     Require all granted
     RewriteEngine On
     LogLevel trace3
     RewriteRule ^wms/(.+)$
/cgi-bin/qgis_mapserv.fcgi?map=/home/geogf405/PROJETS/$1.qgs [QSA,PT,L]
     RewriteRule ^balades/(.+)$
http://example.com/qgiswebclient.html?map=/home/geogf405/PROJETS/$1.qgs
#    RewriteRule ^balades/(.+)$
/qgiswebclient.html?map=/home/geogf405/PROJETS/$1.qgs
   </Directory>

   ScriptAlias /cgi-bin/ /home/geogf405/qgis-web-client/cgi-bin/
   <Directory "/home/geogf405/qgis-web-client/cgi-bin/">
     AllowOverride None
     Options +ExecCGI -MultiViews -SymLinksIfOwnerMatch
     Require all granted
     #Uncomment the next line to enable logging to a file
     #SetEnv QGIS_LOG_FILE /tmp/qgislog.txt
   </Directory>

So currently, when I enter example.com/balades/moritz it rewrites (or
actually redirects) to
http://example.com/qgiswebclient.html?map=/home/geogf405/PROJETS/moritz.qgs.

However, with that solution, it is the above URL which appears in the
browser. I would like to be able to enter example.com/balades/moritz and
keep seeing that URL but get the same result as
http://example.com/qgiswebclient.html?map=/home/geogf405/PROJETS/moritz.qgs.
This works perfectly with the first RewriteRule for wms.

So I tried with the (currently commented) second RewriteRule concerning
"balades":

RewriteRule ^balades/(.+)$ /qgiswebclient.html?map=/home/geogf405/PROJETS/$1.qgs

This just gives me a blank page in the Browser, no error message.

Looking at the logs, the rewrite seems to work, but apparently then an internal
redirect happens and everything is stripped from the URL:

[Tue Apr 29 11:30:56.452602 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] add path info postfix: /home/geogf405/qgis-web-client/site/balades
-> /home/geogf405/qgis-web-client/site/balades/moritz.qgs
[Tue Apr 29 11:30:56.452615 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/balades/moritz.qgs
-> balades/moritz.qgs
[Tue Apr 29 11:30:56.452623 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^wms/(.+)$' to uri 'balades/moritz.qgs'
[Tue Apr 29 11:30:56.452636 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] add path info postfix: /home/geogf405/qgis-web-client/site/balades
-> /home/geogf405/qgis-web-client/site/balades/moritz.qgs
[Tue Apr 29 11:30:56.452645 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/balades/moritz.qgs
-> balades/moritz.qgs
[Tue Apr 29 11:30:56.452651 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^balades/(.+)$' to uri 'balades/moritz.qgs'
[Tue Apr 29 11:30:56.452673 2014] [rewrite:trace2] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] rewrite 'balades/moritz.qgs' -> '/qgiswebclient.html?map=/home/geogf405/PROJETS/moritz.qgs.qgs'
[Tue Apr 29 11:30:56.452683 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
split uri=/qgiswebclient.html?map=/home/geogf405/PROJETS/moritz.qgs.qgs -> uri=/qgiswebclient.html,
args=map=/home/geogf405/PROJETS/moritz.qgs.qgs
[Tue Apr 29 11:30:56.452715 2014] [rewrite:trace1] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] internal redirect with /qgiswebclient.html [INTERNAL
REDIRECT]
[Tue Apr 29 11:30:56.452771 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c675150/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/qgiswebclient.html
-> qgiswebclient.html
[Tue Apr 29 11:30:56.452780 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c675150/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^wms/(.+)$' to uri 'qgiswebclient.html'
[Tue Apr 29 11:30:56.452786 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c675150/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/qgiswebclient.html
-> qgiswebclient.html
[Tue Apr 29 11:30:56.452791 2014] [rewrite:trace3] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c675150/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^balades/(.+)$' to uri 'qgiswebclient.html'
[Tue Apr 29 11:30:56.452795 2014] [rewrite:trace1] [pid 14753:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34876] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a64b50][rid#7fe67c675150/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] pass through /home/geogf405/qgis-web-client/site/qgiswebclient.html


When I add [QSA,PT,L] at the end of the RewriteRule, I get the same result in the browser,
but slightly different messages in the log:


[Tue Apr 29 11:39:01.466778 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] add path info postfix: /home/geogf405/qgis-web-client/site/balades
-> /home/geogf405/qgis-web-client/site/balades/moritz
[Tue Apr 29 11:39:01.466790 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/balades/moritz
-> balades/moritz
[Tue Apr 29 11:39:01.466798 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^wms/(.+)$' to uri 'balades/moritz'
[Tue Apr 29 11:39:01.466809 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] add path info postfix: /home/geogf405/qgis-web-client/site/balades
-> /home/geogf405/qgis-web-client/site/balades/moritz
[Tue Apr 29 11:39:01.466816 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/balades/moritz
-> balades/moritz
[Tue Apr 29 11:39:01.466824 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^balades/(.+)$' to uri 'balades/moritz'
[Tue Apr 29 11:39:01.466846 2014] [rewrite:trace2] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] rewrite 'balades/moritz' -> '/qgiswebclient.html?map=/home/geogf405/PROJETS/moritz.qgs'
[Tue Apr 29 11:39:01.466855 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
split uri=/qgiswebclient.html?map=/home/geogf405/PROJETS/moritz.qgs -> uri=/qgiswebclient.html,
args=map=/home/geogf405/PROJETS/moritz.qgs
[Tue Apr 29 11:39:01.466863 2014] [rewrite:trace2] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] forcing '/qgiswebclient.html' to get passed
through to next API URI-to-filename handler
[Tue Apr 29 11:39:01.466869 2014] [rewrite:trace1] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c67a0a0/initial]
[perdir /home/geogf405/qgis-web-client/site/] internal redirect with /qgiswebclient.html [INTERNAL
REDIRECT]
[Tue Apr 29 11:39:01.466929 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c677368/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/qgiswebclient.html
-> qgiswebclient.html
[Tue Apr 29 11:39:01.466937 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c677368/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^wms/(.+)$' to uri 'qgiswebclient.html'
[Tue Apr 29 11:39:01.466955 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c677368/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] strip per-dir prefix: /home/geogf405/qgis-web-client/site/qgiswebclient.html
-> qgiswebclient.html
[Tue Apr 29 11:39:01.466964 2014] [rewrite:trace3] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c677368/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] applying pattern '^balades/(.+)$' to uri 'qgiswebclient.html'
[Tue Apr 29 11:39:01.466971 2014] [rewrite:trace1] [pid 14957:tid 140627917055744] mod_rewrite.c(475):
[client XXX.XXX.XXX.XXX:34942] XXX.XXX.XXX.XXX - - [example.com/sid#7fe684a5eb50][rid#7fe67c677368/initial/redir#1]
[perdir /home/geogf405/qgis-web-client/site/] pass through /home/geogf405/qgis-web-client/site/qgiswebclient.html

I have trouble understanding the entire process of internal redirection and rewriting. I imagine
that this is some simple configuration (RewriteBase ?) that needs to be added/changed, but
I just can't wrap my head around it. Could someone give me pointers to where to look for the
solution (and yes, I've read though the page on mod_rewrite, but this hasn't put me on the
right path, yet) ?

Thank you !

Moritz


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


Mime
View raw message