url write problem

Discussion in 'C#' started by digitalstyle_surat, Jul 30, 2009.

  1. #1
    Hi..

    I m asp programmer and hosted one website at godaddy windows server with iis-7

    Name of my website is http://www.theoutletscenter.com

    Now I want to rewrite url to make them seo friendly..

    I want to rewrite this url.

    Orignal url - http://www.theoutletscenter.com/product.asp?ID=7
    Final url - http://www.theoutletscenter.com/product/7


    For that i m using following code in web.config file..

    ================================
    <configuration>
    <system.webServer>
    <rewrite>
    <rules>
    <rule name="Rewrite to product.asp">
    <match url="^product/([0-9]+)/([_0-9a-z-]+)" />
    <action type="Rewrite" url="product.asp?ID={R:1}" />
    </rule>
    </rules>
    <outboundRules>
    <preConditions>
    <preCondition name="HTML Only">
    <add input="{HTTP_CONTENT_TYPE}" pattern="^text/html" />
    </preCondition>
    </preConditions>
    <rule name="rewrite to clean url" preCondition="HTML Only">
    <match filterByTags="A" pattern="^/product\.asp\?ID=([0-9]+)$" />
    <action type="Rewrite" value="/product/{R:1}" />
    </rule>
    </outboundRules>
    </rewrite>
    </system.webServer>
    </configuration>
    =============================================

    But I m getting error..can anyone suggest me solution for this..

    Thanks in advance
     
    digitalstyle_surat, Jul 30, 2009 IP
  2. boomers

    boomers Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You supply more info, such as the particular error message.

    Try urlrewriting.net - its very easy to include and use in projects.
     
    boomers, Aug 3, 2009 IP
  3. Free Born John

    Free Born John Guest

    Messages:
    111
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I've never been happy with url rewriting in IIS.

    If you don't have too many products you could create a shell page for each, or append the product name to the querystring or go for an seo friendly directory structure. All would probably achieve the same seo benefits as url rewrites.
     
    Free Born John, Aug 10, 2009 IP
  4. VishalVasani

    VishalVasani Peon

    Messages:
    560
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    VishalVasani, Aug 16, 2009 IP
  5. SlitheryImp

    SlitheryImp Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Shouldn't <match url="^product/([0-9]+)/([_0-9a-z-]+)" />
    be
    <match url="^product/([_0-9a-z-]+)" />
     
    SlitheryImp, Aug 28, 2009 IP