[MapServer-users] Mapserver Apache2 Rewrite not working

Richard Greenwood richard.greenwood at gmail.com
Fri Dec 23 12:17:50 PST 2022


You might try [QSA] Query String Append
https://cwiki.apache.org/confluence/display/HTTPD/RewriteFlags+QSA
Something like:
    RewriteRule
Sentinel2Ukraine
/cgi-bin/mapserv?map=/DyskPlanetiler/MAPFILEs/Sentinel2Ukraine.map
[QSA]
Or maybe:
    RewriteRule ^Sentinel2Ukraine$
/cgi-bin/mapserv?map=/DyskPlanetiler/MAPFILEs/Sentinel2Ukraine.map  [QSA]

You could also put your map file in an Apache environment variable in your
apache2.conf file like:
    SetEnv Sentinel2Ukraine /DyskPlanetiler/MAPFILEs/Sentinel2Ukraine.map
And then reference it like:
    map=Sentinel2Ukraine
If you do that then you can add a little security by setting another Apache
env var:
    SetEnv MS_MAP_NO_PATH "foo"
as described here
https://mapserver.org/environment_variables.html#environment-variables

Hope that helps,
Rich

On Fri, Dec 23, 2022 at 5:38 AM Marcin Niemyjski via MapServer-users <
mapserver-users at lists.osgeo.org> wrote:

> Hello,
> I'm trying to shorten my mapfile url from https://www.****.eu/cgi-bin/mapserv?map=/DyskPlanetiler/MAPFILEs/Sentinel2Ukraine.map
> to
> https://www.****.eu/Sentinel2Ukraine.
>
> I'm doing it by writing
> RewriteEngine onRewriteRule Sentinel2Ukraine?(.*)
> /cgi-bin/mapserv?map=/DyskPlanetiler/MAPFILEs/Sentinel2Ukraine.map&$1
> into apache2.conf but there is no result (I do restart apach after each
> edition of apache2.conf). QGIS while connecting to WMS returns "Download of
> capabilities failed: Error transferring https://www.****.eu/Sentinel2Ukraine?SERVICE=WMS&REQUEST=GetCapabilities
> - server replied: Not Found"
>
> What am I doing wrong?
> Best,
> Marcin
> _______________________________________________
> MapServer-users mailing list
> MapServer-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>


-- 
Richard W. Greenwood
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20221223/df96d260/attachment.htm>


More information about the MapServer-users mailing list