.htaccess - 地图服务器包装 cgi-bin/mapserv 和 map=mapfile.map 的问题
问题描述
我正在使用 Mapserver 7.0.7 (MS4W 3.2.8),我无法包装 cgi-bin/mapserv 和 map=mapfile.map
工作正常
在.htaccess 中使用RewriteRule 进入我的leafletjs web 上的文件夹
RewriteRule ^ms(.*)$ http://localhost/cgi-bin/mapserv.exe?map=C:/ms4w/apps/Leaflet/mapserver/Leaflet.map $1
结果:
Not Found The requested URL /Leaflet/ms&service=WMS&request=GetMap&layers=LAT&styles=&format=image/png&transparent=true&version=1.3.0&tiled=true&width=512&height=512&crs=EPSG:3857&bbox=-6574807.424977722,-3443946.7464169012,-6261721.357121639,-3130860.67856082 was在此服务器上找不到。
但是是一个有效的 GetCapabilities 请求
http://localhost/Leaflet/ms&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
推荐阅读
- windows - 如何登录远程 iis8 服务器?
- conditional-statements - Tradingview Pine:在触及某个价格之前不要激活警报
- r - 无法使用 R 4.0.1 安装 ggplot 2
- ios - 以编程方式更改为 SwiftUI 中的另一个选项卡
- java - Problem: The use of JOptionPane stops my JPanels from switching
- bash - HDMI 断开时如何关闭树莓派?
- yaml - 如何在 Ada 中读取 yaml 文件
- reactjs - 将服务器数据获取到 React + Redux 应用程序的最佳方式
- javascript - 将 Dolar (U$) 转换为 Real (R$),反之亦然
- python - 来自字典列表的python数据框,其中一些值作为列表