Htaccess somehow automatically romoves all trailing slashes at the end of an url and keeps only one.
For example http://localhost/api/param1/// becomes http://localhost/api/param1/
Can you please tell me why this happens and how to get rid of this? The (.*) should match everything right? But it does not. Like I said, if I go to http://localhost/api/param1/// the $_GET['url']
should be param1///
but it is param1/
.
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
Apache automatically strips multiple slashes into a single slash in RewriteRule
pattern.
If you want to capture multiple slashes use a RewriteCond
instead:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/(.*)$
RewriteRule ^ index.php?url=%1 [QSA,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With