[MapServer-users] Does the map parameter value in a query have to be absolute?
Bjørn Ove Grøtan
bjorn.ove at grotan.com
Wed Jul 23 08:02:49 PDT 2025
Rob Dennett via MapServer-users:
> I have a situation where I have .map files in two different directories, one
> called stage and one called prod. If there were a .map in each directory
> called foo.map, I would like to be able to reference it by making my query
> parameter map=/foo.map and setting the directory in configuration, rather
> than being forced to use map=/stage/foo.map or map=/prod/foo.map as the case
> may be. Is this possible with some mapserver config? I found this
> StackExchange article
> https://gis.stackexchange.com/questions/315039/mapserver-data-root
> [https://cdn.sstatic.net/Sites/gis/Img/apple-touch-icon@2.png?v=54e3ab1edcf3]<https://gis.stackexchange.com/questions/315039/mapserver-data-root>
> Mapserver data root - Geographic Information Systems Stack
> Exchange<https://gis.stackexchange.com/questions/315039/mapserver-data-root>
> There is no concept of a data root, for a mapserver installation, or for a
> mapserver service. You can use local references within any map file to
> include other map files gis.stackexchange.com Which shows how you could use
> ScriptAlias in the Apache config to create an alias for each .map file, but
> we have over a thousand of them.
If you are usign Apache, you can configure using a mix of virtualhost and SetEnvIfs
SetEnvIf Host "www-dev\.example\.com" MAP=/path/to/dev.map
SetEnvIf Host "www-production\.example\.com" MAP=/path/to/prod.map
or whatever suites your needs: https://httpd.apache.org/docs/current/mod/mod_setenvif.html
You could possible make a regexp-rule rather than hardcoding as above
--
Kind regards
Bjørn Ove Grøtan
More information about the MapServer-users
mailing list