Web.Config - URL Rewrite RRS feed

  • Question

  • User-2014164074 posted

    I need help.  I am trying to write a multiple URL rewrite rules.  I have this:

    my website is broken down into 4 areas: Pages, News, Articles, Search.  If a user clicks on a page, i.e., mydomain.com/pages/hello then the URL Rewrite would be mydomain.com/htmlpage.aspx?Q=Hello.  If the user clicks on an article. i.e. mydomain.com/article/usa-elections-2020 then the URL Rewrite would be mydomain.com/article.aspx?Q=usa-elections-2020.  If the user clicks on page 2 of News, i.e., i.e. mydomain.com/news/2 then the URL Rewrite would be mydomain.com/news.aspx?P=2.  and so on.  I need the XML code under the web.config file.  I have the following but only the first rule works:

    <httpErrors errorMode="Detailed"></httpErrors>
        <asp scriptErrorSentToBrowser="true"></asp>

    <rule name="HTML Page" stopProcessing="true">
              <match url="(.*)$"  ignoreCase="false" />
                <add input="{URL}" pattern="/pages/(.*)" />
              <action type="Rewrite" url="htmlpage.aspx?Page={R:1}"  appendQueryString="true" />

    <rule name="Article Page" stopProcessing="true">
              <match url="(.*)$"  ignoreCase="false" />
                <add input="{URL}" pattern="/articles/(.*)" />
              <action type="Rewrite" url="article.aspx?Q={R:1}"  appendQueryString="true" />


    I hope this makes what I seek clear.  Please send me the exact code that works under GoDaddy Shared Hosting as they are so trouble makers.



    Thursday, October 1, 2020 6:30 AM

All replies