i need a nginx rewrite rule for the following problem:
I have Urls that include several hyphen and eventually underscores
Example request: http://www.example.com/cat/cat2/200-AB---a-12_12-123.312/cat-_-cat/cat/dog---I
would give a 404 error so in need a 301- redirect to:
http://www.example.com/cat/cat2/200-AB-a-12-12-123.312/cat-cat/cat/dog-I
So all underscores should be replaced with hyphens and there should be only one hyphen a time.
short version: replace --- with - and replace _ with - but by replacing _ with - this -_- will become --- and rule one would have to be called again.
Is it possible to to that in one rule? and if not how to do it any other way :)i have absolutely no idea how to do that with nginx
any help appreciated :)