Reputation: 313
Htaccess somehow automatically removes 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]
Upvotes: 6
Views: 242
Reputation: 1
I had this problem and the solution is this:
RequestConfig requestConfig = RequestConfig.custom()
.setNormalizeUri(false)
.build();
just .setNormalizeUri(false)
is the important point.
and pass it (requestConfig
) to HttpClients
like this:
HttpClients.custom()
.setDefaultRequestConfig(requestConfig)
.build();
Upvotes: 0
Reputation: 784998
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]
Upvotes: 4