asp.net - Issue with Similar Rewrite Rules in Web.config -
i have rule in web.config works.
<rule name="guestbook rewrite" stopprocessing="true"> <match url="(.*?)-guestbook" /> <action type="rewrite" url="guestbook.asp?gb={r:1}" /> </rule>
when goes mydomain.com/view-guestbook or mydomain.com/sign-guestbook go appropriate pages.
what having difficulty have several pages of guestbook entries, want able add rule when goes “view-guestbook-page-9” getting mydomain.com/guestbook.asp?gb=view&pagenum=9. had added following rule, did got 500 errors. going guess either in conflict previous rule or syntax incorrect.
<rule name="guestbook view page rewrite" stopprocessing="true"> <match url="view-guestbook-page-(.*)" /> <action type="rewrite" url="guestbook.asp?gb=view&pagenum={r:1}" /> </rule>
how can have both rules or single rule solve both?
i got figured out. had add condition first rule not other rule. looks likes this:
<rule name="guestbook rewrite" stopprocessing="true"> <match url="(.*?)-guestbook" /> <conditions> <add input="{request_uri}" pattern="view-guestbook-page-" negate="true" /> </conditions> <action type="rewrite" url="guestbook.asp?gb={r:1}" /> </rule> <rule name="view guestbook page rewrite" stopprocessing="true"> <match url="view-guestbook-page-(.*)" /> <action type="rewrite" url="guestbook.asp?pagenum={r:1}" /> </rule>
Comments
Post a Comment