http-redirectumbraco7permanent

permanent url redirect in umbraco 7


I was having old url like http://mydomain/blog/posts/2015/february/fill-and-follow/

and new url now is like http://mydomain/blog/posts/fill-and-follow/

So, for above scenario I want to write re-write rule. I am using rule as follows in UrlRewriting.config.

<add name="urlRedirect1"
 virtualUrl= "http://mydomain/blog/posts(.*)"
 rewriteUrlParameter="ExcludeFromClientQueryString"
 destinationUrl="http://mydomain/blog/posts/$1/"
 ignoreCase="true"
 redirect="Application"
 redirectMode="Permanent" /> 

What will be the actual rule?


Solution

  • solved the above.

    the correct answer is as below.

    <add name="BlogRewrite"
    virtualUrl="http://mydomain/blog/posts/(.*)/(.*)/(.*)/$"
    rewriteUrlParameter="ExcludeFromClientQueryString"
    destinationUrl="http://mydomain/blog/posts/$3/"
    redirect="Domain"
    redirectMode="Permanent"
    ignoreCase="true" />