Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

regular-expression-http-uri rediriction

mika
Cirrus
Cirrus

HELLO,

-http://www.abc.com/C1234" >>> I want to match on http://www.abc.com/xyz/qsdf=C1234 

-http://www.abc.com/C4536" >>> I want to match on http://www.abc.com/xyz/qsdf=C4536

-http://www.abc.com/C7865" >>> I want to match on http://www.abc.com/xyz/qsdf=C7865

......

anything numbers after /C

thank you for your answer

2 REPLIES 2

Hi mika,

when HTTP_REQUEST {
	if { [HTTP::uri] matches_regex {\/C[0-9]{1,4}} } {
		set uri "/xyz/qsdf=[string trimleft [HTTP::uri] \"/\"]"
		# log local0. "newUri: $uri"
		HTTP::redirect "http://www.abc.com$uri"
	}
}

thank you 🙂