Hiding the map= parameter from a map server application

In the mapserver documentation, one is told to use a cgi-wrapper script to hide the map= parameter. Then there is shown a script to use on ‘any system having a /bin/sh’ I tried to rewrite that as a php-script to use under windows, but that did not work, so apaches mod_rewrite to the rescue in three small steps:

1) Comment out the mod_rewrite line in httpd.conf

2) Enable mod_rewrite for the actual document root. I am using virtual servers and added the following lines in the actual <VirtualHost > section:

<Directory “c:\documents and settings\vserver\radioecology”>
Options FollowSymLinks
AllowOverride All
</Directory>

2.5 Restart apache

3 make a .htaccess file in the actual directory:

RewriteEngine on
RewriteRule ^wmsmap?(.*) /cgi-bin/mapserv.exe?map=/documents+and+settings/vserver/radioecology/mobilweb/mobilwms.map&$1

The rewriteRule says: given a webpage starting with wmsmap, pick out the query parameters, make a new page request starting with /cgi-bin/mapserv.exe?map=(…)? and add on whatever was the query parameter in the original page request. Quite simple when one just knows how to do it.

This entry was posted in Diverse, mapserver. Bookmark the permalink.

Comments are closed.