Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Ajay Rathod 8 posts 77 karma points
    Oct 17, 2015 @ 07:52
    Ajay Rathod
    0

    URl Rewriting To Try Dynamically

    Hello EveryOne , I Am Try Dynamic Write code In UrlRewriting.config for Url-Rewrite and Redirect For Url :-

    http://www.test.com.au/test1/test2/test3/test4/test5/

    I am Use This Code For 5th Level Of Url-Rewrite and Redirect:-

      <add name="redirect_test_level4/5" redirect="Application" redirectMode="Permanent" virtualUrl="^~/test1/(.*)/(.*)/(.*)/(.*)/(.*)/$" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="~/$4/$5" ignoreCase="true" />
    <add name="test-rewrite-level2"
                    virtualUrl="^/(test5)/(.+)/?$"
                    rewriteUrlParameter="ExcludeFromClientQueryString"
                    destinationUrl="/test1/test2/test3/test4/$1/$2"
                    ignoreCase="true" />
    

    Get Results :-

    http://www.test.com.au/test4/test5

    Any Idea To Done Dynamic URL Rewriting And Not Any Name Use For Reference To Write In Code , Please Reply Best Solution .

    Thanks In Advance ...Regard Ajay Rathod

  • Paul Seal 524 posts 2889 karma points MVP 7x c-trib
    Jan 21, 2016 @ 18:30
    Paul Seal
    0

    Hi Ajay Try my solution in this article. Please let me know if it helps? http://www.codeshare.co.uk/blog/create-a-redirect-page-in-umbraco-without-editing-the-config-file/

    Paul

  • Ajay Rathod 8 posts 77 karma points
    Jan 22, 2016 @ 13:59
    Ajay Rathod
    0

    Thanks Paul Seal for reply , I am try dynamically Url-Rewrite and Redirect ,not static name to use for Url-Rewrite and Redirect . For example Write code In UrlRewriting.config for Url To Rewrite and Redirect try dynamic :-

    https://www.test.com.au/test1/test2/test3/

    <add name="redirect_test-level1" redirect="Application" redirectMode="Permanent" virtualUrl="^~/test1/(.*)/(.*)/$" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="~/$1/$2" ignoreCase="true" />
    
    <add name="test-rewrite-level1"
                 virtualUrl="^/(.+)/(.+)/?$"
                 rewriteUrlParameter="ExcludeFromClientQueryString"
                 destinationUrl="/test1/$1/$2"
                 ignoreCase="true" />
    

    its Working and get result :-

    https://www.test.com.au/test2/test3

    but try one more level add for Rewrite and Redirect Url :-

    https://www.test.com.au/test1/test2/test3/test4/

    <add name="redirect_test-level2" redirect="Application" redirectMode="Permanent" virtualUrl="^~/test1/(.*)/(.*)/(.*)/$" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="~/$2/$3" ignoreCase="true" />
    <add name="test-rewrite-level2"
                 virtualUrl="^/(.+)/(.+)/(.+)/?$"
                 rewriteUrlParameter="ExcludeFromClientQueryString"
                 destinationUrl="/test1/$1/$2/$3"
                 ignoreCase="true" />
    

    Its working only redirect not rewrite and show 404 page Error . if any idea or solution this problem ,please reply

Please Sign in or register to post replies

Write your reply to:

Draft