Quantcast
Channel: URL Rewrite Module
Viewing all articles
Browse latest Browse all 2482

Url rewrite base on query IIS asp.net

$
0
0

I'm doing this for the first time need help.  How to write code to url rewrite base on query

I need to:

http://www.Example/Ekonomija/Ekonomija.aspx?Ekonomija=something

to be

http://www.Example/Ekonomija/something

and

http://www.Example/Test2/Test2.aspx?Test2=something

to be

http://www.Example/Test2/something

and

http://www.Example/Test3/Test3.aspx?Test3=something

to be

http://www.Example/Test3/something

and so on ....



  Need solution with url rewrite: 2.0


I managed to do this, but the first rule work, second no. probably query string not not accurately done, don't know. What I doing wrong?

<rule name="RedirectUserFriendlyURL1" stopProcessing="true"><match url="^Ekonomija/Ekonomija\.aspx$" /><conditions><add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /><add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" /></conditions><action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" /></rule><rule name="RewriteUserFriendlyURL1" stopProcessing="true"><match url="^([^/]+)/([^/]+)/?$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /></conditions><action type="Rewrite" url="Ekonomija/Ekonomija.aspx?{R:1}={R:2}" /></rule><rule name="RedirectUserFriendlyURL2" stopProcessing="true"><match url="^Test2/Test2\.aspx$" /><conditions><add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" /><add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" /></conditions><action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" /></rule><rule name="RewriteUserFriendlyURL2" stopProcessing="true"><match url="^([^/]+)/([^/]+)/?$" /><conditions><add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /><add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /></conditions><action type="Rewrite" url="Test2/Test2.aspx?{R:1}={R:2}" /></rule>


Viewing all articles
Browse latest Browse all 2482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>