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?
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.