Im using urlrewrite.net @ http://urlrewriter.net to perform url rewrites on a .net website hosted on a Windows 2003 server with IIS 6.
I need to simply turn a long dynamic url such as:
http://mydomain.com/aircraft/result.aspx?view=,734,,810,,159,,163&cat=1&loc=999999&model=false
into a shorter friendlier url such as:
http://mydomain.com/forsale/manufacturer/,734,,810,,159,,163,/1/999999/false
I have the following rule in my web.config:
<rewrite url="^/forsale/(.+)/(.+)/(.+)/(.+)/(.+)" to="/aircraft/result.aspx?view=$2&cat=$3&loc=$4&model=$5" / >
This works fine when I enter the following as the url:
http://mydomain.com/forsale/manufacturer/,734,,810,,159,,163,/1/999999/false
However, as soon as I trigger any sort of postback it enters an infinite loop and the url in the browser address bar goes all crazy eg:
http://mydomain.com/aircraft/result.aspx?view=1&cat=999999&loc=detailed.aspx?AId=32270&Cat=Business-Jets&seo=Bombardier&model=Challenger%20300&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1&cat=1
It seems to be reverting to the real url but adding duplicated querystring variables..
Ideally I would like this to maintain the shorter/friendlier rewritten url but this isnt crucial. The main aim is to be able to actually allow postback events so that the page is fit for purpose.
Any help / suggestions / pointers / answers will be greatly appreciated!
Thanks in advance.
The infinite loop was due to a bit of redirect code on the page which was only causing an issue when accessed in this way. Removing it has solved the loop issue but has caused the real querystring to be appended on the rewrite url.