Re: [mapserver-users] Rewrite rule problem
Goran, for good Open Source karma would you mind recording and publishing all of your steps, to get MS4W and Apache to do the rewriting you need? You can add the new page on the MapServer wiki (https://github.com/mapserver/mapserver/wiki) or even directly on the MS4W wiki (https://www.ms4w.com/trac/wiki), whatever is easiest for you. A huge thank you for that. -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ On 2017-11-01 7:12 PM, gorank wrote: Hi Andreas, Finally it works perfectly and it solved most of my problems. I would like to go one step forward. How will looks SetEnvIfExpr and Rewrite rule in case when in the mapfile there is a Real time substitution parameter (in my case year - 2015, 2016, ...) I would like to write url as you proposed in previous post but with added year parameter. Example for year 2015: from http://localhost:81/cgi-bin/GDZ/2015/wms?map=N1.map=GetCapabilities=WMS=1.3.0 to get http://localhost:81/cgi-bin/GDZ/wms?year=2015=N1.map=GetCapabilities=WMS=1.3.0 I tried to do it following your logic but not successfully. Best regards, Goran ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Rewrite rule problem
Hi Andreas, Finally it works perfectly and it solved most of my problems. I would like to go one step forward. How will looks SetEnvIfExpr and Rewrite rule in case when in the mapfile there is a Real time substitution parameter (in my case year - 2015, 2016, ...) I would like to write url as you proposed in previous post but with added year parameter. Example for year 2015: from http://localhost:81/cgi-bin/GDZ/2015/wms?map=N1.map=GetCapabilities=WMS=1.3.0 to get http://localhost:81/cgi-bin/GDZ/wms?year=2015=N1.map=GetCapabilities=WMS=1.3.0 I tried to do it following your logic but not successfully. Best regards, Goran -- Sent from: http://osgeo-org.1560.x6.nabble.com/Mapserver-User-f4226646.html ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Rewrite rule problem
Hi Goran, the RewriteRule should match the Location for SetEnvIfExpr: SetEnvIfExpr "%{QUERY_STRING} =~/^(.*&)?map=([[:alnum:]]+.map)(&.*)?$/" MS_MAPFILE=C:/ms4w/apps/Demo/$2 RewriteEngine On RewriteRule /cgi-bin/GDZ/wms /cgi-bin/GDZ/wms?MAP=MS_MAPFILE [PT,QSA] And then the URL http://localhost:81/cgi-bin/GDZ/wms?map=N1.map=GetCapabilities=WMS=1.3.0 should set the MS_MAPFILE environment variable to "C:/ms4w/apps/Demo/N1.map" and rewrite the URL to http://localhost:81/cgi-bin/GDZ/wms?MAP=MS_MAPFILE=N1.map=GetCapabilities=WMS=1.3.0 This should work as MapServer scans the query parameters from left to right. It first finds MAP=MS_MAPFILE and checks if there's an environment variable set assuming that it points to a valid map file. The SetEnvIfExpr has set this variable for the URL "/cgi-bin/GDZ/wms" if a "MAP" parameter was provided. HTH > -Ursprüngliche Nachricht- > Von: mapserver-users [mailto:mapserver-users-boun...@lists.osgeo.org] Im > Auftrag von gorank > Gesendet: Montag, 30. Oktober 2017 16:24 > An: mapserver-users@lists.osgeo.org > Betreff: Re: [mapserver-users] Rewrite rule problem > > Hi Andreas, > > As you sugested I have added in* httpd.conf* file following > > > and when I put URL > > I receive the following message: > msLoadMap(): Unable to access file. (N1.map) > > As addition in the C:/ms4w/httpd.d folder I have file httpd_Demo.conf > file > with following content > > Alias /Demo/ "/ms4w/apps/Demo/" > > AllowOverride None > Options Indexes FollowSymLinks Multiviews > Order allow,deny > Allow from all > > > What I'm doing wrong. > > Best regards, > Goran > > > > -- > Sent from: http://osgeo-org.1560.x6.nabble.com/Mapserver-User- > f4226646.html > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > https://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org https://lists.osgeo.org/mailman/listinfo/mapserver-users