here's a trick to make MapServer URLs shorter
Gregor Mosheh
stigmata_blackangel at YAHOO.COM
Fri Jan 21 13:18:20 PST 2005
I came up with a solution that I thought would be of
interest to everybody, so here it is. It seems to work
well in all the cases we've tested, but of course any
feedback is welcome.
Problem: MapServer URLs are horribly long, what with
all the program= and map= and mode= stuff in the query
string.
Solution: Set up an Apache handler and a wrapper
script, so that an URL pointing to a .map file causes
MapServer to run instead.
This is a CGI program. Put it into your cgi-bin
directory and chmod it. And you'll need to fix a few
of the paths to match your own installation.
#!/bin/sh
# if there's no query string, make a basic one
# assuming they want browse mode
if [ "$QUERY_STRING" = "" ]; then
QUERY_STRING="mode=browse&program=/cgi-bin/mapserv.cgi"
fi
export QUERY_STRING
# the URL they gave is the URL to the mapfile
# appending the mapfile to the query string
# helps with browse mode
MS_MAPFILE=$PATH_TRANSLATED
export MS_MAPFILE
QUERY_STRING=$QUERY_STRING"&map=$PATH_TRANSLATED"
# now just run MapServer now
exec /usr/local/apache/cgi-bin/mapserv.cgi
Then, in Apache's httpd.conf file, set up a handler.
Anything with a .map extension gets sent to that
wrapper.
# make MapServer mapfiles "executable"
Action mapfilewrapper /cgi-bin/mapfilewrappper.cgi
AddHandler mapfilewrapper .map
So now instead of this:
http://server/cgi-bin/mapserv?map=/home/bob/public_html/maps/foo.map&mode=browse&program=/cgi-bin/mapserv
You should be able to do this:
http://server/~bob/foo.map
__________________________________
Do you Yahoo!?
All your favorites on one personal page Try My Yahoo!
http://my.yahoo.com
More information about the MapServer-users
mailing list