Mohammad Aman

Mohammad Aman

  • Tech Writer
  • 327
  • 72.1k

Rewrite Rules in separate web config file

Dec 21 2015 1:53 AM
m using URL rewriting in my application, I have two config file as given below, first one have configuration and second one have for Rules. but I am getting 404 Error
Web.Config
 
<system.webServer>
<rewrite>
<!--<rewriteMaps configSource="rewritemaps.config"></rewriteMaps>-->
<rules configSource="rewritemaps.config"></rules>
</rewrite>
</system.webServer>
 
rewriteMaps.Config 
<system.webServer>
<rewrite>
<rules>
<rule name="RewriteURLHometPaging" stopProcessing="true">
<match url="^Home$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action appendQueryString="false" type="Rewrite" url="Default.aspx" logRewrittenUrl="true" />
</rule>
<!--<rule name="RedirectURLHomePaging" stopProcessing="true">
<match url="^Default\.aspx$" />
<action appendQueryString="false" type="Redirect" url="Home" />
</rule>-->
<!--<rule name="RedirectURLContactPaging" stopProcessing="true">
<match url="^Contact-Us\.aspx$" />
<action appendQueryString="false" type="Redirect" url="Contactus" />
</rule>-->
<rule name="RewriteURLContactPaging" stopProcessing="true">
<match url="^Contactus$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action appendQueryString="false" type="Rewrite" url="Contact-Us.aspx" logRewrittenUrl="true" />
</rule>
<!--<rule name="RedirectURLAboutPaging" stopProcessing="true">
<match url="^About-Us\.aspx$" />
<action appendQueryString="false" type="Redirect" url="About" />
</rule>-->
<rule name="RewriteURLAboutPaging" stopProcessing="true">
<match url="^About$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action appendQueryString="false" type="Rewrite" url="About-Us.aspx" logRewrittenUrl="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
 

Answers (1)