Quantcast
Viewing all articles
Browse latest Browse all 27852

Rewrite Rules with FileMapProvider

Hi,
I've installed the Url Rewrite Module 2.0 with the URL Rewrite Extensibility Samples (allowes us to use custom providers for the rewrite\redirect rules - in my case: external .txt file with the rules). I added the following lines to my web.config as shown in the tutorials at iis.net - http://learn.iis.net/page.aspx/803/using-custom-rewrite-providers-with-url-rewrite-module/ :

<rewrite>
<providers>
<provider name="FileMap" type="FileMapProvider, Microsoft.Web.Iis.Rewrite.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<settings>
<add key="FilePath" value="{DOCUMENT_ROOT}\App_Data\redirectmappings.txt" />
<add key="IgnoreCase" value="1" />
<add key="Separator" value="," />
</settings>
</provider>
</providers>
<rules>
<rule name="FileMapProviderTest" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{FileMap:{R:1}}" pattern="(.+)" />
</conditions>
<action type="Redirect" url="{C:1}" />
</rule>
</rules>
</rewrite>

It works great, but I need to do is rewrite and not redirect. I have the following code:


<rule name="RewriteCustomDomainUser" stopProcessing="true">
<match url="^(.*)$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.example-url-user1.com$" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="/user/user-one/{PATH_INFO}" appendQueryString="true" /> </rule>

This code rewrites the folder of a particular user for its own domain, it works fine, but get more and more users, it is difficult to add many rules in the web.config.


I added in my App_Data folder rewritemappings.txt file with this content:
www.example-url-user1.com, user-one
www.example-url-user2.com, user-anything
My question is if I can add these parameters in the rule RewriteCustomDomainUser with FileMapProvider.
Thank you very much!

Viewing all articles
Browse latest Browse all 27852

Trending Articles