U4-7331 - URl Rewriting To Try Dynamically

Created by Er.Ajay Rathod 17 Oct 2015, 09:04:12 Updated by Er.Ajay Rathod 03 Feb 2016, 13:25:13

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

Comments

Er.Ajay Rathod 03 Feb 2016, 13:24:12

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


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty:

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions:

Due in version:

Sprint:

Story Points:

Cycle: