locked
Rewrite assistance RRS feed

Answers

  • User299556178 posted

    Sorry for asking, but why use a rewrite map when we seem to have a pattern? Wouldn't this work and redirect all your articles?

    <rule name="Redirect article" stopProcessing="true">
    <match url="^steveschofield/archive/(.*)/(.*)/(.*)/(.*)\." />
    <action type="Redirect" url="http://www.iislogs.com/steveschofield/{R:4}" redirectType="Permanent" />

    Unless i have misunderstood something.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 9, 2011 6:51 AM
  • User-176674611 posted

    Hi Steve,

    Does someone know if "redirect" links can be logged? 

    When you choose "Rewrite" as action type, you can see the "Log rewritten URL" option available in UI. The option means whether log the rewritten url or not. For example, if your rule rewrite pageA.aspx to pageB.aspx. Without the option ticked(the default setting), IIS will log pageA.aspx as request in IIS log. When you tick the option, the rewritten page will be logged instead, in this case it's pageB.aspx.

    When redirect is choosen as action type, a new request with redirected url will be generated. In that case, the redirect url will always be logged. As you seen, there's no "Log rewritten URL" option when you use "Redirect".

    I hope I understand the question correctly and have made it clear.

    Thanks.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 9, 2011 9:45 PM

All replies

  • User1073881637 posted

    Here is the rule that was needed to do what I wanted it to do.  Thanks to some assistance from a good friend who is a url rewrite guru.

      <rule name="Redirect article" stopProcessing="true">
    <match url="(archive/2005/12/31/change-schema-name-on-tables-and-stored-procedures-in-sql-server-2005.aspx)" />
      <action type="Redirect" url="http://www.iislogs.com/steveschofield/change-schema-name-on-tables-and-stored-procedures-in-sql-server-2005" redirectType="Permanent" />

    Wednesday, June 8, 2011 8:58 AM
  • User1080221284 posted

    I'm guessing you have a slew of articles to redirect, might look at using a rewrite map instead:

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

    Wednesday, June 8, 2011 2:05 PM
  • User1073881637 posted
    Are you suggesting I could have a rewrite map and one redirect rule?
    Wednesday, June 8, 2011 2:32 PM
  • User1080221284 posted
    Yep, exactly.
    Wednesday, June 8, 2011 2:37 PM
  • User1073881637 posted

    Just need to get a list of all articles and match them up. :)))

    Wednesday, June 8, 2011 3:49 PM
  • User1073881637 posted

    Do you have a suggestion for regular expression for dummies.     

    It's spelled out, this is the pattern weblogs.asp.net uses.

    r slash archive slash 4 digit match slash 2 digit match slash 2 digit match slash article period aspx

    r/archive/2005/12/31/change-schema-name-on-tables-and-stored-procedures-in-sql-server-2005.aspx

    Here is the pattern it needs to match on
    change-schema-name-on-tables-and-stored-procedures-in-sql-server-2005

    Off to google!

    Wednesday, June 8, 2011 7:57 PM
  • User1073881637 posted

    With the help of regex coach, here is the regular expression.  Not sure to do with it next, stay tuned. :)

    archive/\d{4}/\d{2}/\d{2}/.+(?=\.).aspx

    Wednesday, June 8, 2011 8:40 PM
  • User1080221284 posted

    Rewrite maps don't support pattern matching. They would be good if you needed to match disimilar URLs to do something like:

    /steves/article.aspx?id=1 -> /myblog/blog-post-1.aspx
    /archive/2005/12/31/mypost.aspx -> /myblog/blog-post-2.aspx

    But if everything on the old blog and new blog follow the same article naming convention, and all you need to do is drop the "/archive/2005/12/31" and redirect, then this should work:

                    <rule name="NewBlog" stopProcessing="true">
                        <match url="archive/\d{4}/\d{2}/\d{2}/(.+(?=\.).aspx)" />
                        <action type="Redirect" url="http://www.iislogs.com/steveschofield/{R:1}" />
                    </rule>

    Thursday, June 9, 2011 5:23 AM
  • User299556178 posted

    Sorry for asking, but why use a rewrite map when we seem to have a pattern? Wouldn't this work and redirect all your articles?

    <rule name="Redirect article" stopProcessing="true">
    <match url="^steveschofield/archive/(.*)/(.*)/(.*)/(.*)\." />
    <action type="Redirect" url="http://www.iislogs.com/steveschofield/{R:4}" redirectType="Permanent" />

    Unless i have misunderstood something.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 9, 2011 6:51 AM
  • User-2064283741 posted
    <!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:TrackMoves/> <w:TrackFormatting/> <w:PunctuationKerning/> <w:ValidateAgainstSchemas/> <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid> <w:IgnoreMixedContent>false</w:IgnoreMixedContent> <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText> <w:DoNotPromoteQF/> <w:LidThemeOther>EN-US</w:LidThemeOther> <w:LidThemeAsian>X-NONE</w:LidThemeAsian> <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> <w:DontGrowAutofit/> <w:SplitPgBreakAndParaMark/> <w:DontVertAlignCellWithSp/> <w:DontBreakConstrainedForcedTables/> <w:DontVertAlignInTxbx/> <w:Word11KerningPairs/> <w:CachedColBalance/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> <m:mathPr> <m:mathFont m:val="Cambria Math"/> <m:brkBin m:val="before"/> <m:brkBinSub m:val="--"/> <m:smallFrac m:val="off"/> <m:dispDef/> <m:lMargin m:val="0"/> <m:rMargin m:val="0"/> <m:defJc m:val="centerGroup"/> <m:wrapIndent m:val="1440"/> <m:intLim m:val="subSup"/> <m:naryLim m:val="undOvr"/> </m:mathPr></w:WordDocument> </xml><![endif]--><!--[if gte mso 9]><xml> <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true" DefSemiHidden="true" DefQFormat="false" DefPriority="99" LatentStyleCount="267"> <w:LsdException Locked="false" Priority="0" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Normal"/> <w:LsdException Locked="false" Priority="9" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="heading 1"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/> <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/> <w:LsdException Locked="false" Priority="39" Name="toc 1"/> <w:LsdException Locked="false" Priority="39" Name="toc 2"/> <w:LsdException Locked="false" Priority="39" Name="toc 3"/> <w:LsdException Locked="false" Priority="39" Name="toc 4"/> <w:LsdException Locked="false" Priority="39" Name="toc 5"/> <w:LsdException Locked="false" Priority="39" Name="toc 6"/> <w:LsdException Locked="false" Priority="39" Name="toc 7"/> <w:LsdException Locked="false" Priority="39" Name="toc 8"/> <w:LsdException Locked="false" Priority="39" Name="toc 9"/> <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/> <w:LsdException Locked="false" Priority="10" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Title"/> <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/> <w:LsdException Locked="false" Priority="11" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/> <w:LsdException Locked="false" Priority="22" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Strong"/> <w:LsdException Locked="false" Priority="20" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/> <w:LsdException Locked="false" Priority="59" SemiHidden="false" UnhideWhenUsed="false" Name="Table Grid"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/> <w:LsdException Locked="false" Priority="1" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 1"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 1"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 1"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/> <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/> <w:LsdException Locked="false" Priority="34" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/> <w:LsdException Locked="false" Priority="29" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Quote"/> <w:LsdException Locked="false" Priority="30" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 1"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 1"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 2"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 2"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 2"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 2"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 2"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 3"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 3"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 3"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 3"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 3"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 4"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 4"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 4"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 4"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 4"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 5"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 5"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 5"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 5"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 5"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/> <w:LsdException Locked="false" Priority="60" SemiHidden="false" UnhideWhenUsed="false" Name="Light Shading Accent 6"/> <w:LsdException Locked="false" Priority="61" SemiHidden="false" UnhideWhenUsed="false" Name="Light List Accent 6"/> <w:LsdException Locked="false" Priority="62" SemiHidden="false" UnhideWhenUsed="false" Name="Light Grid Accent 6"/> <w:LsdException Locked="false" Priority="63" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/> <w:LsdException Locked="false" Priority="64" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/> <w:LsdException Locked="false" Priority="65" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/> <w:LsdException Locked="false" Priority="66" SemiHidden="false" UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/> <w:LsdException Locked="false" Priority="67" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/> <w:LsdException Locked="false" Priority="68" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/> <w:LsdException Locked="false" Priority="69" SemiHidden="false" UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/> <w:LsdException Locked="false" Priority="70" SemiHidden="false" UnhideWhenUsed="false" Name="Dark List Accent 6"/> <w:LsdException Locked="false" Priority="71" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/> <w:LsdException Locked="false" Priority="72" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful List Accent 6"/> <w:LsdException Locked="false" Priority="73" SemiHidden="false" UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/> <w:LsdException Locked="false" Priority="19" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/> <w:LsdException Locked="false" Priority="21" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/> <w:LsdException Locked="false" Priority="31" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/> <w:LsdException Locked="false" Priority="32" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/> <w:LsdException Locked="false" Priority="33" SemiHidden="false" UnhideWhenUsed="false" QFormat="true" Name="Book Title"/> <w:LsdException Locked="false" Priority="37" Name="Bibliography"/> <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/> </w:LatentStyles> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin-top:0cm; mso-para-margin-right:0cm; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0cm; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin;} </style> <![endif]-->

    I don't have url write in front of me (waiting for 4 days at a new consultancy even for a login....*sigh*) and coming to this thread late but when I first read this I thought the logic need was

    just ignore the /archive/2005/12/31/

    or even if possible better just ignore /*anything here*/*anything here*/*anything here*/*anything here*/

    just as long as there are x amount of / in there with anything inbetween.

    I would not even look for the amount of characters and the enforcement if they are decimal. I mean do you have 03/03 for the 3rd of March or 3/03 or 03/3/ etc. Because enforcing 2 decimals as the above example will not work then.

    Hope that helps.

    Thursday, June 9, 2011 6:53 AM
  • User1073881637 posted

    The Orchard BlogML import dropped the .aspx on all articles names.   I updated the URL match to not include .aspx portion, I get the error below. I think I'm close, the R:1 is kind of confusing. 

    HTTP Error 500.50 - URL Rewrite Module Error.

    The expression "http://www.iislogs.com/steveschofield/{R:1}" cannot be expanded.

    Old URL

    http://weblogs.asp.net/steveschofield/archive/2011/02/25/february-2011-iis-community-newsletter-published.aspx

    New URL

    http://www.iislogs.com/steveschofield/february-2011-iis-community-newsletter-published

    Steve

    Thursday, June 9, 2011 7:02 AM
  • User1073881637 posted

    I missed your posts, maybe caching. Here is what I came up with.  Thanks for the assistance, I'd like to understand why mine doesn't work even though using The RegEx Coach returns the same data

    Gives error
      <rule name="Redirect article" stopProcessing="true">
       <match url="^archive/\d{4}/\d{2}/\d{2}/.+\." />
       <action type="Redirect" url="http://www.iislogs.com/steveschofield/{R:4}" redirectType="Permanent" />
      </rule>

    HTTP Error 500.50 - URL Rewrite Module Error.
    The expression "http://www.iislogs.com/steveschofield/{R:4}" cannot be expanded.

    WORKS

      <rule name="Redirect article" stopProcessing="true">
       <match url="^archive/(.*)/(.*)/(.*)/(.*)\." />
       <action type="Redirect" url="http://www.iislogs.com/steveschofield/{R:4}" redirectType="Permanent" />
      </rule>

    Thursday, June 9, 2011 7:27 AM
  • User1080221284 posted

    {R:4} doesn't exist in your rule - you only have {R:0}. The () around each section puts that matched pattern into a variable.

    Thursday, June 9, 2011 9:02 AM
  • User299556178 posted

    Because I am smarter than the RegEx Coach?  :-)

    In the one that gives error, you do not have and parenthesis. These are used to tell the action part what to map {R:4} to. So in the working example, you see 4 (.*). We want the last one, hence we use {R:4}.

    In the non-working, you are trying to tell URL Rewrite to use {R:4}, but is not defined and has no value. That's why you get this error message.

    Thursday, June 9, 2011 9:03 AM
  • User1073881637 posted

    KristoferG - You are genius level then! :))

    *blush* I didn't know the () brackets indicated stuff being evaluated.  I do now, learn something everyday.   RegEX is one of those things I've avoided along with advanced rewriter stuff.  I knew enough about rewriting I could achieve what I needed to keep the links active while switching domains.  I have a lot of articles that are referenced with the old link and I didn't want to impact users trying to find them. 

    Thursday, June 9, 2011 2:34 PM
  • User1073881637 posted

    Here are the final rules.  The last couple days, thanks everyone for their assistance.  I have a better understand of RegEX and URL Rewriter.    Does someone know if "redirect" links can be logged?  I know rewrite rules can be logged or that is what I read.

        <rewrite>
          <rules>
            <rule name="Redirect archive Article" stopProcessing="true">
              <match url="archive/(.*)/(.*)/(.*)/(.*)\." />
              <action type="Redirect" url="http://www.iislogs.com/steveschofield/{R:4}" appendQueryString="false" redirectType="Permanent" />
            </rule>
            <rule name="Redirect default.aspx" stopProcessing="true">
              <match url="(default.aspx)" />
              <action type="Redirect" url="http://www.iislogs.com/steveschofield/" appendQueryString="false" redirectType="Permanent" />
            </rule>
            <rule name="Redirect Everything Else" stopProcessing="true">
              <match url=".*" />
              <action type="Redirect" url="http://www.iislogs.com/steveschofield/" appendQueryString="false" redirectType="Permanent" />
            </rule>
          </rules>
        </rewrite>

     

    Thursday, June 9, 2011 5:41 PM
  • User-176674611 posted

    Hi Steve,

    Does someone know if "redirect" links can be logged? 

    When you choose "Rewrite" as action type, you can see the "Log rewritten URL" option available in UI. The option means whether log the rewritten url or not. For example, if your rule rewrite pageA.aspx to pageB.aspx. Without the option ticked(the default setting), IIS will log pageA.aspx as request in IIS log. When you tick the option, the rewritten page will be logged instead, in this case it's pageB.aspx.

    When redirect is choosen as action type, a new request with redirected url will be generated. In that case, the redirect url will always be logged. As you seen, there's no "Log rewritten URL" option when you use "Redirect".

    I hope I understand the question correctly and have made it clear.

    Thanks.

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Thursday, June 9, 2011 9:45 PM
  • User1073881637 posted

    Makes sense thanks

    Thursday, June 9, 2011 10:27 PM