سؤال

I'm trying to use Tuckey's UrlRewriteFilter to rename a query string parameter if it exists. I want to rename "foo" to "bar".

Examples:

  • /hello/hey/?foo=123 should be /hello/hey/?bar=123

  • /nascar/?a=b&foo=lol should be /nascar/?a=b&bar=lol

Any ideas?

هل كانت مفيدة؟

المحلول

Try this:

<urlrewrite>

    <rule>
       <from>^(.*)(\?|&)foo=(.*)$</from>
       <to type="redirect">$1$2bar=$3</to>
    </rule>

</urlrewrite>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top