.net - ASP.Net 301 redirects and URL rewriting -


i changed structure of page urls of 1 of websites using url rewriting , need redirect old structure new 1 (to handle old links indexed google). problem want redirect rewritten url, not actual url , cannot find way this.

before changes had following urls:

rewriterule ^products/([^_\r\n//]*)/([^_\r\n//]*)/$ /products.aspx?cat=$1&subcat=$2 [nc,l]

after changes, have following:

rewriterule ^products-([^_\r\n//]*)-([^_\r\n//]*)/$ /products.aspx?cat=$1&subcat=$2 [nc,l]

what want issue 301 redirect urls match

^products/([^_\r\n//]*)/([^_\r\n//]*)/$ ^products-([^_\r\n//]*)-([^_\r\n//]*)/$,

ie, have following rule:

rewriterule ^products-([^_\r\n//]*)-([^_\r\n//]*)/$ products-([^_\r\n//]*)-([^_\r\n//]*)/ [nc,l]

the above rule produces following error:

"the page isn't redirecting properly"

is there way .net or using url rewrite rules?

any grately appreciated.

ok, fixed problem using following rule:

rewriterule ^products-([^_\r\n//]*)-([^_\r\n//]*)/$ /redir.aspx?url=/products-$1-$2/ [nc,l]

what redir.aspx page write 301 code header , transfer new url passed parameter it.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -