I use the default MapServer URL to view the map in browser.


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. How can I achieve this?


You need to create a wrapper script to achieve this

if [ "${REQUEST_METHOD}" = "GET" ]; then
  if [ -z "${QUERY_STRING}" ]; then
  exec ${MAPSERV}
  echo "Sorry, I only understand GET requests."
exit 1
# End of Script

Source: mapserver.org

PS: the script only works for GET requests.

Another alternative is to use php/python mapscript for creating the web pages. its very easy and you need to install corresponding mapscript bindings see here for more info. Here is an example of php mapscript

  • Thank you @rashad for quick reply. I tried the example (the php one). I am stuck from the beginning. When I execute my .php file in browser nothing appears as told in the first output of the example. I used the example .php code given and used the mapfile I had. I changed the $map_path to my basemaps folder which included the osm-google.map file. – MWH May 22 '13 at 11:59
  • what does the error log says. if you are using ubuntu it should be located in /var/log/apache2/error.log. else please find the location of apache error log and access log – rkm May 22 '13 at 12:49

There are alternatives to wrapper scripts. See: http://mapserver.org/ogc/wms_server.html#changing-the-online-resource-url

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.