« Previous Next »

Answered Thread: How to prevent use of strings after URL rewrite

Last post 11-12-2009 5:10 PM by mav21. 3 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (4 items)

Sort Posts:

  • 11-08-2009, 4:18 AM

    • mav21
    • Not Ranked
    • Joined on 11-08-2009, 3:50 AM
    • Posts 3

    How to prevent use of strings after URL rewrite

    Hello all... I recently applied IIS 7 URL Rewriting to our website and it is working quite well.

    Somehow some users are however landing on our site with a rewritten URL with an asp-page and querystring attached to the URL. This effectively means the same variable is requested twice, causing an internal server error.

    Let me explain with an example:
    http://www.example.com/item/202/some-title
    would request
    http://www.example.com/item.asp?ID=202&title=some-title
    from the server, which works fine.

    But some users are landing at:
    http://www.example.com/item/202/some-title/item.asp?ID=202
    which leads to the server looking for
    http://www.example.com/item.asp?ID=202&title=some-title&ID=202

    The ID-variable is queried twice, which results in a server error.

    I realise one of the priorities should be to find out how users are landing there, but I imagine there would also be a way to redirect/rewrite any queries to such pages to a 404 or - better - strip it of the 'item.asp?ID=202' part.

    I have tried a number of rewriting rules, but unfortunately without succes. Any suggestions would be very welcome. Thank you...
  • 11-09-2009, 9:24 AM In reply to

    • mav21
    • Not Ranked
    • Joined on 11-08-2009, 3:50 AM
    • Posts 3

    Answered Re: How to prevent use of strings after URL rewrite

    I've solved the above using an Array now, only using the first instance in all databasequeries on that page. Would still be interested to know if a URL Rewrite rule could have solved this too, though. Thanks...

  • 11-09-2009, 4:05 PM In reply to

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

    Answered Re: How to prevent use of strings after URL rewrite

    In the rewrite rule set the flag appendQueryString="false" (uncheck the "Append query string" check box in UI)

    http://ruslany.net
  • 11-12-2009, 5:10 PM In reply to

    • mav21
    • Not Ranked
    • Joined on 11-08-2009, 3:50 AM
    • Posts 3

    Re: How to prevent use of strings after URL rewrite

    Thank you very much!
Page 1 of 1 (4 items)
Microsoft Communities