« Previous Next »

Thread: Maximum number of rewrite rules

Last post 01-26-2009 3:10 PM by ruslany. 10 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (11 items)

Sort Posts:

  • 07-23-2008, 10:15 AM

    • dgrose
    • Not Ranked
    • Joined on 07-17-2008, 1:42 PM
    • Birmingham, UK
    • Posts 6

    Maximum number of rewrite rules

     Hi,

    What is the maximum number of rules you can set up in the globalmodules?

    I have around 10,000 pages that need to have a permanant redirect, unfourtunately they are uniqe pages.

    Thanks

    Dave

  • 07-23-2008, 12:35 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: Maximum number of rewrite rules

    If you have so many permanent redirects and they are all unique pages, then you should consider using rewrite maps, instead of creating 10,000 rewrite rules.

    To learn more about rewrite maps in URL rewrite module check out these links:

    http://learn.iis.net/page.aspx/469/using-rewrite-maps-in-url-rewrite-module/

    http://ruslany.net/2008/07/iisnet-uses-url-rewrite-module/

     

    http://ruslany.net
  • 07-24-2008, 5:17 AM In reply to

    • dgrose
    • Not Ranked
    • Joined on 07-17-2008, 1:42 PM
    • Birmingham, UK
    • Posts 6

    Re: Maximum number of rewrite rules

     Thanks Ruslan,

    I set them up in the applicationHost.config file and it works great.

    FYI, when I put them in the web.config file, I got an error message complaining the web.config file was too big (it was just over 2MB in size).

    Regards

    Dave

  • 07-24-2008, 11:02 AM In reply to

    • ksingla
    • Top 25 Contributor
    • Joined on 06-14-2006, 3:02 AM
    • Redmond, WA
    • Posts 863

    Re: Maximum number of rewrite rules

    Max size of web.config allowed is 250KB by default. You can change regkey HKLM\SOFTWARE\Microsoft\InetStp\Configuration\MaxWebConfigFileSizeInKB to allow bigger web.config if needed. Read more here.

    -Kanwal-

    Follow me on twitter at http://twitter.com/kjsingla
  • 07-24-2008, 11:06 AM In reply to

    Re: Maximum number of rewrite rules

    dgrose:

     Thanks Ruslan,

    I set them up in the applicationHost.config file and it works great.

    FYI, when I put them in the web.config file, I got an error message complaining the web.config file was too big (it was just over 2MB in size).

    Regards

    Dave

     

    Seriously if you web.config is that big I would look at some other way of solving your problem. 

  • 07-24-2008, 4:21 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: Maximum number of rewrite rules

    As an alternative to putting huge rewrite map into applicationHost.config you can put it into a separate config file and then reference that config file from your web.config:

    For example, create a file named rewritemaps.config and put this inside of it:

    <rewriteMaps>
     <rewriteMap name="TestMap" >
      <add key="foo" value="bar" />
      <add key="goo" value="dada" />
     </rewriteMap>
    </rewriteMaps>

    Then in your web.config reference this file:

    <rewriteMaps configSource="rewritemaps.config" />

    http://ruslany.net
  • 12-25-2008, 8:47 AM In reply to

    • DarkMaster
    • Top 500 Contributor
    • Joined on 07-06-2006, 9:05 AM
    • Murska Sobota, Slovenia
    • Posts 19

    Re: Maximum number of rewrite rules

    Hello.

    I am more then sorry to bump such an old thread but since from here most of my questions are based upon, I did not want to star a new thread. So here is my question for proper including external rewrite map config.

    I have my CMS setup so, that upon creation of new article, it automatically ads new rewrite and redirect entry. Now for better layout I wish to have those entries in a separate file as also ruslany suggested. Now I have added rewrite map configsource in web.config and created corresponding file, added my rewrite map entries but now all I get is an mis-configured/bad-formed XML file.

    I would like to have clarification on this property - I mean I know how to include other config files - I use separate config file to include connection string - that one works just fine. I just can not get this one working properly. Or perhaps there is some other misconfiguration for this that I am missing.

    Here are my settings:

    In web.config file I have this:

    <system.webServer>
     <rewrite>
      <reqriteMaps configsource="articlemap.config">
      <rules>
       <some_rewrite_rules>
      </rules>
     </rewrite>
    </system.webServer>

    ...and in articlemap.config I have:

    <rewriteMaps>
     <rewriteMap name="redirmap">
      <add_some_key>
     </rewriteMap>
    </rewriteMaps>

    So what am I missing? Is this a problem of referencing for rewrite map name or some other semantical issue? Help?

    Who are you? What do you want?
  • 12-29-2008, 1:21 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: Maximum number of rewrite rules

    There is a typo in the XML - <reqriteMaps>. Also it does not have the closing tag. It should be written as below:

     <rewriteMaps configSource="articlemap.config" />

    http://ruslany.net
  • 12-31-2008, 6:21 AM In reply to

    • DarkMaster
    • Top 500 Contributor
    • Joined on 07-06-2006, 9:05 AM
    • Murska Sobota, Slovenia
    • Posts 19

    Re: Maximum number of rewrite rules

    hooooly.... Thanks ruslany - the typo was only in the post - but I think that I forgot about the self closing tag :S well - I am too embarrassed to talk anymore of this so I will just humbly thank you again and go away :)

    Happy new year guys!

    Who are you? What do you want?
  • 01-26-2009, 8:13 AM In reply to

    • LockyBoy
    • Not Ranked
    • Joined on 01-26-2009, 1:07 PM
    • Posts 1

    Re: Maximum number of rewrite rules

     Hi

    Just want to revise this thread - I'm having problems setting up a rewrite map config file.

    In my web.config file I have:

     <rewrite>
          <rewriteMaps configSource="rewrite.config" />
         <rules>
           <rule name="SolidWoodProduct">
              <match url="^Realwoodflooring/solidwoodflooring/([0-9]+)/" />
              <action type="Rewrite" url="/realwoodflooring/solidwoodflooring/product.aspx?productid={R:1}" />
            </rule>
            <rule name="EngineeredWoodProduct">
              <match url="^Realwoodflooring/engineeredwoodflooring/([0-9]+)/" />
              <action type="Rewrite" url="Realwoodflooring/engineeredwoodflooring/product.aspx?productid={R:1}" />
            </rule>
            <rule name="LaminateFlooring">
              <match url="^laminate/([0-9]+)/" />
              <action type="Rewrite" url="Laminate/product.aspx?productid={R:1}" />
            </rule>
            <rule name="CarpetFlooring">
              <match url="^carpet/([0-9]+)/" />
              <action type="Rewrite" url="carpet/product.aspx?productid={R:1}" />
            </rule>
            <rule name="VinylFlooring">
              <match url="^vinyl/([0-9]+)/" />
              <action type="Rewrite" url="vinyl/product.aspx?productid={R:1}" />
            </rule>
            <rule name="Accessories">
              <match url="^accessories/([0-9]+)/" />
              <action type="Rewrite" url="accessories/product.aspx?productid={R:1}" />
            </rule>
           <<rule name="Redirect Rule" stopProcessing="true">
             <match url=".*" />
             <conditions>
                <add input="{StaticRedirects:{REQUEST_URI}}" pattern="(.+)" />
              </conditions>
              <action type="Redirect" url="http://www.ourwebsite.com{C:1}" appendQueryString="False" redirectType="Permanent" />
            </rule>
          </rules>
        </rewrite>

     

    And have a seperate rewrite.config file with the following:

       <rewriteMaps>
            <rewriteMap name="StaticRedirects">
              <!-- Up to date as of 07/01/09 ask Danielle before amending -->
              <add key="/acatalog/Online_Catalogue_Karndean_Flooring_41.html" value="/newsite.aspx"/>
              <add key="/ar_upside.cfm" value="/newsite.aspx"/>
              <add key="/Bacu.cfm" value="/newsite.aspx"/>
             ------etc etc etc-----------------------------
    </rewritemap>
    </rewriteMaps>

     I want the Redirect Rule to process from the rewrite.config file 

    , and all other rules as per the web config.

    I can open up the rewrite map in IIS7, so I know thats good, and can include the reference in the config to the rewrite.config map. If I leave the Redirect Rule in the web.config, I get a generaic 500 error, and the site only works when I comment out the Redirect Rule.

     

    Can anyone give me a pointer as to what I', doing wrong?!

     

    Thanks

     

     

     

     

     

  • 01-26-2009, 3:10 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 7:38 PM
    • Redmond, WA
    • Posts 661

    Re: Maximum number of rewrite rules

    Can you enable detailed error messages in IIS and let me know what error is reported with 500 status code?

    http://ruslany.net
Page 1 of 1 (11 items)
Microsoft Communities