[Mapserver-dev] redirect

Steve Lime steve.lime at dnr.state.mn.us
Mon Oct 27 15:52:39 EST 2003


This probably is a question for the main list, more opinions. I've tried
this myself with limited success as well, but that was because I had
multiple services on one machine to foward to another machine and Apache
doesn't allow you to do any matching (i.e. RedirectMatch) on the query
string. You likely have the same issue since you need to modify the
query string to change directories. My solution was to redirect to a
perl script instead where I had more control over matches on query
parameters. 

In httpd.conf I have:

RedirectMatch /cgi-bin/mapserv$ /cgi-bin/forward_mapserv.pl

and forward_mapserv.pl looks like:

----------------------------------- BEGIN SNIP
-------------------------------------------
#! /usr/bin/perl -w

use CGI;

# Script to forward old calls to /cgi-bin/mapserv to
# the write spot in the CMS. Mainly to support embedded
# calls in a few LMIC applications.

$query_string = $ENV{"QUERY_STRING"};

$cgi = new CGI;

if($query_string =~ /photos.map/) {
  $query_string =~ s/photos\/etc\/photos\.map/AIRPHOTOS_MAPFILE/;
  $url =
"http://www.dnr.state.mn.us/airphotos/browse.html?".$query_string;
} elsif($query_string =~ /view.map/) {
  $query_string =~
s/%2Fusr%2Flocal%2Fwww%2Fdocs%2Fcompass%2Fview\.map/COMPASS_MAPFILE/;
  $query_string =~
s/\/usr\/local\/www\/docs\/compass\/view\.map/COMPASS_MAPFILE/;
  $url =
"http://www.dnr.state.mn.us/maps/compass.html?".$query_string;
}

print $cgi->redirect($url);
exit 0;
----------------------------------- END SNIP
-------------------------------------------

Works ok for me...

Steve

>>> "Dan Liu" <dan.liu at mnplan.state.mn.us> 10/27/2003 2:27:56 PM >>>
Hi all,
I need to do a redirect from
http://url1/cgi-bin/mapserv?&map=/dir1/county.map 
to 
http://url2/cgi-bin/mapserv?&map=/dir2/county.map 

But it is not working. Does somebody know why?
Thanks in Advance.
Dan





_______________________________________________
Mapserver-dev mailing list
Mapserver-dev at lists.gis.umn.edu 
http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev



More information about the mapserver-dev mailing list