Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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

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

share|improve this question
add comment

2 Answers 2

You need to create a wrapper script to achieve this

#!/bin/sh
MAPSERV="/path/to/my/mapserv"
MAPFILE="/path/to/my/mapfile.map"
if [ "${REQUEST_METHOD}" = "GET" ]; then
  if [ -z "${QUERY_STRING}" ]; then
    QUERY_STRING="map=${MAPFILE}"
  else
    QUERY_STRING="map=${MAPFILE}&${QUERY_STRING}"
  fi
  exec ${MAPSERV}
else
  echo "Sorry, I only understand GET requests."
fi
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

share|improve this answer
    
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 –  rashad May 22 '13 at 12:49
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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