映射服务器包装 cgi-bin/mapserv 和 map=mapfile.map 时遇到问题



我正在使用Mapserver 7.0.7(MS4W 3.2.8(,我在包装cgi-bin/mapserv和map=mapfile.map时遇到问题


工作正常

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map&service=WMS&request=GetMap&layers=LAT&styles=&format=image%2Fpng&transparent=true&version=1.3.0&tiled=true&width=512&height=512&crs=EPSG%3A3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082

结果


在 .htaccess 中使用 RewriteRule 到我的传单 Web 上的文件夹中

RewriteRule ^ms(.*($ http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map$1

http://10.1.3.21/Leaflet/ms&service=WMS&request=GetMap&layers=LAT&styles=&format=image%2Fpng&transparent=true&version=1.3.0&tiled=true&width=512&height=512&crs=EPSG%3A3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082

结果:

未找到 在此服务器上找不到请求的 URL/Leaflet/ms&service=WMS&request=GetMap&layers=LAT&styles=&format=image/png&transparent=true&version=1.3.0&tileed=true&width=512&height=512&crs=EPSG:3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082。


但是一个有效的获取功能请求

http://localhost/Leaflet/ms&service=WMS&version=1.0.0&request=GetCapabilities

并替换为 =>

http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map&service=WMS&version=1.0.0&request=GetCapabilities

结果:

<!--  end of DOCTYPE declaration  -->
<WMT_MS_Capabilities version="1.0.0">
<!--
MapServer version 7.0.7 (MS4W 3.2.8) OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=SVG_SYMBOLS SUPPORTS=SVGCAIRO SUPPORTS=ICONV SUPPORTS=FRIBIDI SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS SUPPORTS=POINT_Z_M INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE 
-->
<Service>
<Name>GetMap</Name>
<Title>Leaflet - WMS</Title>
<OnlineResource>http://localhost/Leaflet/ms?</OnlineResource>
</Service>
... 

重写规则正在删除重要的?查询字符串字符,创建无效的请求,例如/Leaflet/ms&service=WMS&...但结果应为/Leaflet/ms?service=WMS...尝试如下规则:

RewriteRule ^ms?(.*)$ http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map$1

最新更新