Forum

Any way to do string replacement in a URI via toolkit?

Rodney Hester
19 February 2015, 18:28
Say I have the following URI:

/extra/this_is_a_test

I want to rewrite it via redirect to read:

/extra/this-is-a-test

(i.e. replace the underscores with spaces)

Is this possible via URL toolkit?

Rodney
Hugo Leisink
19 February 2015, 19:20
You can use this:
UrlToolkit {
ToolkitID = replace
Match _ Rewrite - 20 Continue
}

This will replace up to 20 underscores with a dash. If you want more than 20 replacements, you have to do something like:
UrlToolkit {
ToolkitID = replace
Match !_ Return
Match _ Rewrite - 20 Continue
Do Goto replace
}
This topic has been closed.