0

I have a URL that I use to view my map generated using MapServer.

http://localhost/cgi-bin/mapserv?map=/home/mwh/osm-demo/basemaps/osm-google.map&mode=browse&template=openlayers&layers=all

How can I convert it to more general style such as http://foo.com ?

I just need to show my map in a specific URL like in maps.google.com or www.openstreetmap.com and nothing more. For example I want to hide my directories showing such as /home/mwh/osm-demo/basemaps/ in the original URL.

MWH
  • 399
  • 1
  • 5
  • 19

2 Answers2

0

If you have apache, in your conf file (or .htaccess file) you can add the following lines:

RewriteEngine on

RewriteRule ^mymapserver /cgi-bin2/mapserv.exe?map=/home/mwh/osm-demo/basemaps/osm-google.map&mode=browse&template=openlayers&layers=all& [QSA]

RewriteRule ^mymapserverwms(.*) /cgi-bin/mapserv?map=/home/mwh/osm-demo/basemaps/osm-google.map&SERVICE=WMS&VERSION=1.3.0& [QSA]

In that example, the URL http://localost/mymapserver will translate to your long string.
Please check documentation in Apache for "RewriteEngine".

Cheers, Francesco

Francesco
  • 47
  • 1
  • 7
0

You can use the MapServer variable MS_map as part of a SetEnvIf directive in your Apache configuration like:

SetEnvIf Request_URI "/cgi-bin/mapserv" MS_map file=/home/mwh/osm-demo/basemaps/osm-google.map
user27874
  • 312
  • 3
  • 20