M
M
MTK2013-05-14 18:56:37
Nginx
MTK, 2013-05-14 18:56:37

How to write a rewrite regular expression in nginx that removes the repetition of the characters "/" in url

There is a tricky url system built on regular expressions in the server in the nginx config.
Despite the clear rules, nginx normally returns pages with a url like
domain.dev////////////////module//////////////action///////////

Task: write a rewrite regular expression in the nginx config, so that nginx would transfer the user from the url
domain.dev////////////////module//////////////action///////////
or domain.dev////////////////module//////////////action
to the url of the form
domain.dev/module/action/

As soon as he didn’t try to contrive, it doesn’t work out to the end to do it right.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Sundukov, 2013-05-14
@MTK

Isn't merge_slashes right?

A
AxisPod, 2013-05-14
@AxisPod

I won’t say right off the bat how in nginx, I don’t remember, but if preg, then there is no problem, replace /+ with /
regexr.com?34s90

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question