Htaccess overwrites deletes trailing slashes

Htaccess somehow automatically creates all trailing slashes at the end of the URL and saves only one.

For example, http: // localhost / api / param1 /// becomes http: // localhost / api / param1 /

Could you tell me why this happens and how to get rid of it? (. *) Should it fit all correctly? But this is not so. As I said, if I go to http: // localhost / api / param1 /// , then $_GET['url'] should be param1/// , but it's param1/ .

 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] 
+5
source share
1 answer

Apache automatically splits multiple slashes into a single slash in the RewriteRule pattern.

If you want to capture multiple slashes, use RewriteCond instead:

 RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} ^/(.*)$ RewriteRule ^ index.php?url=%1 [QSA,L] 
+3
source

All Articles