Apache Mod_Rewrite Question Mark

Viewed 47
2 Answers

As though you did not show your try, you could test this:

RewriteEngine On
RewriteCond %{QUERY_STRING} map=([0-9]+)$
RewriteRule . %{REQUEST_URI}?map=C:\\Mapserver\\ms4w\\Apache\\htdocs\\Mapfiles\\%1.map [NE,L]

Rewrite flags used: NE: Not Escape, L: Last instruction to run.

I was still having trouble with the .exe url since it is not accessible if you dont deliver the parameters right when you send the request. And then the redirect wont fire. So I made a dummy mapserver.php file which allows setting a parameter like so:

http://mywebsite.com/abc/mapserver.php?map=123

After hours of trying I ended up with the following RewriteRule:

RewriteCond %{QUERY_STRING} ^map=(.*)$
RewriteRule ^mapserver.php?$ /cgi-bin/mapserv.exe?map=C://Mapserver//ms4w//Apache//htdocs//Mapfiles//%1.map
Related