ISAPI Rewrite rules in web.config

ISAPI_Rewrite is Apache mod_rewrite compatible URL rewriter for Microsoft IIS
User avatar
Posts: 2
Joined: 12 Jul 2017, 01:39

ISAPI Rewrite rules in web.config

12 Jul 2017, 01:48

Hi and excuse my ignorance on the tech stuff here!

I had a developer configure ISAPI rewrite on my windows server (shared hosting) - created some rules that all worked fine in the .htaccess file.

I need to move to a new host and the old coding doesn't work. The hosting company says the rules need to be moved into the web.config file and rewritten.

I have no idea how to do this and am having trouble hiring anyone that can help.

Here is some of my old code that worked fine.

Code: Select all
RewriteBase /
RewriteMap mapfilereviews txt:mapfile/mapfilereviews.txt
RewriteCond %{QUERY_STRING} ^reviewID=[^&]+&n=(.+)
RewriteRule ^pages/reviewDetail\.asp$ %1? [NC,R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^reviews/([^/]+)/?$ pages/rdetail.asp?reviewID=${mapfilereviews:$1}&n=$1 [NC,L]


So ISAPI would rewrite something like:
http://www.mysite.com/pages/rdetail.asp?reviewID=7
to something like
http://www.mysite.com/reviews/review-name

The rule reference a mapfile called mapfilereviews.txt located in the mapfile folder.

If anyone could assist with getting this to work in my web.config file, that would be really appreciated.

And again, excuse my lack of tech understanding here!

User avatar
Posts: 402
Joined: 06 Mar 2012, 11:59

Re: ISAPI Rewrite rules in web.config

12 Jul 2017, 08:50

Hello.

I guess your new hosting provider does not have ISAPI_Rewrite installed, only Microsoft URL Rewrite tool. So you will need to convert your existing rules into MS format. Here is an article on how to do this: https://docs.microsoft.com/en-us/iis/ex ... rite-rules

User avatar
Posts: 2
Joined: 12 Jul 2017, 01:39

Re: ISAPI Rewrite rules in web.config

12 Jul 2017, 21:13

Thanks for the tip.

I tried to import one of my ISAPI rules and it seemed to convert OK. Uploaded to my web.config file but it bombed out at this line:

Code: Select all
The action's expression "pages/ndetail.asp?ArticleID={mapfileNews:{R:1}}&n={R:1}" is not valid.


Not sure what is going on. Does URL Rewrite support mapfiles?

Return to ISAPI_Rewrite 3.0

Who is online

Users browsing this forum: No registered users and 15 guests