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

url rewrite condition is not working in outbound rule

$
0
0

let me explain again what i am trying to do with outbound rule.

when i am browsing my site then address bar url look like http://localhost:8800/gb/default.aspx

my default.aspx has many hyperlink likes

<ahref="/">Home</a><ahref="/About.aspx">Home</a><ahref="/Contact.aspx">Home</a>

i want to rewrite the above hyperlinks href like below way with outbound rules

<ahref="http://localhost:8800/gb/default.aspx">Home</a><ahref="http://localhost:8800/gb/About.aspx">About</a>
<ahref="http://localhost:8800/gb/
Contact.aspx">Contact</a>

but i like take country code from browser url address and include that with all hyperlinks in default.aspx page.

hopefully i am clear what i am trying to do.

i test this outbound rule first

<rulename="outbound rule"preCondition="Ishtml"stopProcessing="true"><matchfilterByTags="A"pattern="([a-z]{2}/)?(.*)"negate="false"/><actiontype="Rewrite"value="/gb{R:2}"/><conditions></conditions></rule>

the above outbound rule worked but the moment i add condition in above outbound rule then outbound rule is not working any more. here is one which is not working. it has condition which causes issue.

<outboundRules><rule name="outbound rule" preCondition="Ishtml" stopProcessing="true"><match filterByTags="A" pattern="([a-z]{2}/)?(.*)" negate="false" /><action type="Rewrite" value="/gb{R:2}" /><conditions><add input="{REQUEST_URI}" pattern="^/([a-z]{2})/(.*)" /></conditions></rule><preConditions><preCondition name="Ishtml"><add input="{RESPONSE_CONTENT_TYPE}" pattern="text/html" /></preCondition></preConditions></outboundRules>

i guess the problem lies in condition.

<conditions><add input="{REQUEST_URI}" pattern="^/([a-z]{2})/(.*)" /></conditions>

OR if i use url instead of request_uri then also not working too

<conditions><add input="{URL}" pattern="^/([a-z]{2})/(.*)" /></conditions>

please help me with one rule which is tested at your side. thanks

basically i do not want to hard code the country code in url. so i need to use condition which hold the country and used in rewrite as back reference but condition is not working whenever i add it in outbound rule. so tell me what to change in above rule?

thanks


Viewing all articles
Browse latest Browse all 2482

Trending Articles



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