Today i will explain you simple and concise way to create rewrite rules for URL rewrite module in web.config, which might panic for most of the developers/users.
<system.webServer> ... <rewrite> <rules> <rule name="Rewrite to article.aspx"> <match url="^news/([0-9]+)" /> <action type="Rewrite" url="article.aspx?id={R:1}" /> </rule> </rules> <outboundRules> <rule name="Rewrite to clean URL" preCondition="IsHTML"> <match filterByTags="A" pattern="^article\.aspx\?id=([0-9]+)$" /> <action type="Rewrite" value="news/{R:1}" /> </rule> <preConditions> <preCondition name="IsHTML"> <add input="{RESPONSE_CONTENT_TYPE}" pattern="^text/html" /> </preCondition> </preConditions> </outboundRules> </rewrite> ... </system.webServer>
Hope this work well who are keen to do and reply your comment.
©2021. All rights reserved. Terms of Use | Privacy Policy
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
Recent Comments