I need to prevent a repetition that may occur on my website with Apache ModSec : I want to redirect this kind of link :
www.example.com/forbidden/forbidden/forbidden/forbidden/index.html?uid=Ys7RZ2RWjrRtTYDoG5cEQgAAAAI
... to this :
www.example.com/forbidden/index.html?uid=Ys7RZ2RWjrRtTYDoG5cEQgAAAAI
note : the "forbidden" part can have many more repetitions
Using RewriteMatch I wrote this logic :
RewriteEngine On
RewriteRule ^/forbidden(.*)index.html\?uid=(.*)$ /forbidden/index.html?uid=$2 [R,L]
But it does not work : I still get a 404 and i'm not rederected to the www.example.com/forbidden/index.html?uid=Ys7RZ2RWjrRtTYDoG5cEQgAAAAI endpoint.
Is the rewrite rule syntax valid for my use case ?