[Qgis-user] Simple Url-Rewriting for the web-client

Gunnar Oehmichen oehm8895 at uni-landau.de
Tue Feb 25 08:00:42 PST 2014


Hello there,

I am trying to approach the problem of url-rewriting for the
qgis-webclient for the first time. For safety purposes I am testing this
on a virtual machine with the enabled site (localhost) registered in
/etc/hosts/. Directory within which the web-client is located:

/home/guna/www/test.de/

(Ubuntu 12.04)

The original url I inserted as a link into an index.html to direct the
user to the webclient is working just fine:

qgiswebclient.html?map=/home/guna/www/test.de/projects/Solarpot_suew2014_3857_2.qgs

As far as I understand  the documentation suggests to me to shorten the
url to the following, which I did

/maps/Solarpot_suew2014_3857_2.qgs

(link-tag: <li class="map-item"><a
href="/maps/Solarpot_suew2014_3857_2.qgs">
            Solarpotential Bornheim</a></li> )

But following the link gets me  a 404 not found error (probably not
surprising at all).

I thought the following Rule to be sufficient, eg just rewriting
http://test.de/maps/Solarpot_suew2014_3857_2.qgs to
qgiswebclient.html?map=/home/guna/www/test.de/projects/Solarpot_suew2014_3857_2.qgs

  <Directory /home/guna/www/test.de/site/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    RewriteEngine On
    # Rewrite /maps/mapname to map url
    RewriteRule ^/maps/(.+)$
qgiswebclient.html?map=/home/guna/www/test.de/projects/$1.qgs [PT]
  </Directory>

Questions:

1.) Within the qgis-web-client.conf rewriting rules are already provided.
-> Do I need to insert these into the Directory tags ( <Directory
/home/guna/www/test.de/site/> ... </Directory>) preceded by a
RewriteEngine ON? Or should I leave the rules where they allready are?

2.) Since there are two directory tags <Directory
/home/guna/www/test.de/site/> and <Directory
"/home/guna/www/test.de/cgi-bin/"> Which of the provided rules have to
be inserted in which directory-tag (if they have to)?

3.) I do not exactly understand the splitup into three rules. I would be
very thankful for a short explanation of the logic here.

  # Rewrite /wms/mapname to
qgis_mapserv.fcgi?map=/<path-to-qgis-server-projects>/mapname.qgs
  RewriteRule ^/wms/(.+)$
/cgi-bin/qgis_mapserv.fcgi?map=/home/guna/www/test.de/projects/$1.qgs
[QSA,PT]

  # Rewrite /maps/mapname to qgis-web-client main page. mapname will be
extracted for wms calls in Javascript code.
  RewriteRule ^/maps/([^\.]+)$ /test.de/site/qgiswebclient.html [PT]

  # Rewrite /maps/* to qgis-web-client/site (e.g.
/maps/gis_icons/mActionZoomNext.png ->
/qgis-web-client/site/gis_icons/mActionZoomNext.png)
  RewriteRule ^/maps/(.*) /test.de/site/$1 [PT]

Thank you very much,

Gunnar

-- 
Gunnar Oehmichen
Quantitative Landscape Ecology
Institute for Environmental Sciences
University Koblenz-Landau
Fortstrasse 7
76829 Landau
Germany
http://www.uni-koblenz-landau.de/landau/fb7/umweltwissenschaften/landscape-ecology/Staff/gunnaroehmichen



More information about the Qgis-user mailing list