Reputation: 5670
I have a URL like this www.mysubdomain.domain.com/brands/bname.aspx
and I want to rewrite it to www.mysubdomain.domain.com/bname
I have done some logic like this
<add name="redirect_brands" redirectMode="Permanent" ignoreCase="true"
rewriteUrlParameter="IncludeQueryStringForRewrite"
virtualUrl="^/brand/(.*)$" destinationUrl="^/$1" />
but this always redirects to home page(/).I am not sure what went wrong..everything looks good to me..Can any one give a me hand on this?
Upvotes: 0
Views: 1017
Reputation: 2215
Try this:
<add name="redirect_brands" redirect="Application" redirectMode="Permanent" virtualUrl="^~/brand/(.*)" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="/$1" ignoreCase="true" />
I think you're missing the ~ in the virtualUrl
Upvotes: 1