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
    Jan 20, 2016 @ 09:17
    Ajay Rathod
    0

    In Url Rewrite Error for dynamically rules

    I am Write code In UrlRewriting.config for Url-Rewrite and Redirect For Url :-

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

    <add name="redirect_test1-level1" redirect="Application" redirectMode="Permanent" virtualUrl="^~/test1/(.*)/(.*)/$" rewriteUrlParameter="IncludeQueryStringForRewrite" destinationUrl="~/$1/$2" ignoreCase="true" />
    
    <add name="test1-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_test1-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

    Thanks In Advance ...Regard Ajay Rathod

Please Sign in or register to post replies

Write your reply to:

Draft