[mapserver-users] Rewrite rule problem

Jeff McKenna jmckenna at gatewaygeomatics.com
Thu Oct 26 11:22:41 PDT 2017


Hi Goran,

Regarding have a cleaner WMS url inside your MS4W installation, you can 
follow the steps at 
http://mapserver.org/ogc/wms_server.html#changing-the-online-resource-url

So that means, if you wanted a clean url like 
http://localhost/cgi-bin/Demo/wms?     you could:

- rename /ms4w/Apache/cgi-bin/mapserv.exe   to /ms4w/Apache/cgi-bin/wms 
(no extension)
- edit /ms4w/Apache/conf/httpd.conf  and add at the bottom something like

   SetEnvIf Request_URI "/cgi-bin/wms" MS_MAPFILE=C:/ms4w/apps/mymap.map

- restart Apache service

    apache-restart.bat

Hope that helps.

-jeff



-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/



On 2017-10-21 4:31 AM, gorank wrote:
> I would like to use Rewrite rules to change path to the map file in the URL
> with mapfile name only.
> 
> Example:
> http://localhost:81/cgi-bin/Demo/wms?map=*/ms4w/apps/Demo/N1.map*&REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0
> 
> for users to be
> 
> http://localhost:81/cgi-bin/Demo/wms?map=*N1.map*&REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.3.0
> 
> I have tried different sugestions in mapserver documenation  but it doesn't
> work.
> 
> I need help somebody to describe step by step:
> 
> 1. Where should be located the new created  .htaccess file (Rewrite mode in
> the httpd.conf file is activated - without #) . In the httpd.conf file
> Document Root is
> 
>                # DocumentRoot: The directory out of which you will serve your
>                # documents. By default, all requests are taken from this
> directory, but
>                # symbolic links and aliases may be used to point to other
> locations.
>                #
>                 DocumentRoot "C:/ms4w/Apache/htdocs"
>                 AccessFileName .htaccess
> 
> 
> 2. What should be written in the .htaccess file in my case
> 
> 3. If i have different Rewrite rules for different paths how to separate
> them in the  .htaccess file
> 
> 
> Best Regards,
> Goran
> 
> 


More information about the mapserver-users mailing list