Need to set friendly URLs for ASP classic web site running on IIS 7 .
There is this rules in my web.config
<rewrite>
<rules>
<rule name="chatter">
<match url="^chatter/default.aspx?article=([0-9]+)" />
<action type="Rewrite" url="chatter/article{R:1}.aspx" />
<conditions>
<add input="{QUERY_STRING}" pattern="^www\.SUB\.DOMAIN\.org$" />
</conditions>
</rule>
</rules>
</rewrite>
Nothing happens when I apply this rule. Please note there is subdomain included. Any help ?
- You simply misunderstood what is URL rewrite so hope you can learn from basic examples.– Lex LiSep 8, 2015 at 1:58
- and what is the URL rewrite
I hope I was able to communicate myself clearly.
Hi Ahad,
URL rewriting is a technique used to change the URL of a web page. It is often used to make URLs more user-friendly, search engine friendly, or to support legacy URLs. The rules in your web.config file are an example of URL rewriting using the IIS URL Rewrite module.
In your specific case, the rule you have defined is trying to rewrite the URL from chatter/default.aspx?article=([0-9]+) to chatter/article{R:1}.aspx, where {R:1} is the captured group from the regular expression in the match pattern. However, the condition you have defined is looking for a query string that matches the pattern ^www\.SUB\.DOMAIN\.org$, which is not related to the URL being rewritten.
You can try to fix the issue, by removing the condition from the rule, and modifying the match pattern to include the subdomain, like this:
<rewrite>
<rules>
<rule name="chatter">
<match url="^chatter/default\.aspx\?article=([0-9]+)" />
<action type="Rewrite" url="http://www.SUB.DOMAIN.org/chatter/article{R:1}.aspx" />
</rule>
</rules>
</rewrite>
This rule should rewrite URLs of the form http://www.SUB.DOMAIN.org/chatter/default.aspx?article=<number> to http://www.SUB.DOMAIN.org/chatter/article<number>.aspx.
Regarding the issue with URL rewriting not working on IIS 8, it is possible that the IIS URL Rewrite module is not installed or configured correctly on the new server. You can try reinstalling the module, or verifying that it is enabled in IIS Manager. Additionally, you can check the IIS logs for more information about the 404 error, which might provide some clues as to what is causing the issue.
Please also be aware that the Telerik UI for ASP.NET AJAX forums are dedicated to discussing issues and features related to the Telerik AJAX product and controls. Therefore, the reported scenario may not be relevant to these forums. We kindly request that you direct such non-Telerik-specific inquiries to the appropriate channels like StackOverflow and Microsoft forums. Thank you for your understanding.