A
A
Alex Me2018-06-11 13:56:18
Apache HTTP Server
Alex Me, 2018-06-11 13:56:18

How does the rule in htaccess work (code in the question)?

have a nice day, everyone!
there was a task - redirects from urls that contain multiple slashes inside to a url with the correct number of slashes (one at a time):
example.com////foo/bar//post
=>
example.com/foo/bar/post
I did everything the way I found it on stackoverflow, but I can’t understand the logic of this setting:

RewriteCond %{THE_REQUEST} //
RewriteRule ^.*$ $0 [R=301,L,NE]

that is, we took the string "GET ////foo/bar//post HTTP/1.1" and {{somehow}} converted it to the desired form. How did this happen and what will the $0 backreference return here?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question