开发者

Regex for Redirection problems (Cherokee Web Server)

开发者 https://www.devze.com 2023-01-06 03:07 出处:网络
I\'m having a real problem with this because I just can\'t get my head around regexes. I\'m using Cherokee Web Server and I\'m trying to use a regex to perform a redirection.

I'm having a real problem with this because I just can't get my head around regexes.

I'm using Cherokee Web Server and I'm trying to use a regex to perform a redirection.

I need to开发者_如何学Go get the following url (for example)

/parts/tr/accessories/tyres

to the controller like this

index.php?page=parts&catalogue=tr&category=accessories&subcategory=tyres

can somebody help me please!

Thanks


I am not familiar with Cherokee, but the regex would be:

([^/]+)/([^/]+)/([^/]+)/([^/]+)

and replacement pattern would look like:

index.php?page=$1&catalogue=$2&category=$3&subcategory=$4
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号