I am currently developing a PHP-backend using a simple router (in the index.php file). Now I have a REST-Call to a route, containing a url-encoded url like this:
https://api.example.com/{encoded url}/information
Example: https://api.example.com/https%3A%2F%2Fwww.example.com%2Fcategory%2Fexample-slug/information
My .htaccess
-file, that should redirect all calls to the index.php file:
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
RewriteRule !^index\.php$ index.php [L]
Now the problem is, that when accessing such a route, the Apache-Server shows me the default 404 page, meaning the request was not redirected to the index.php file. It seems like the encoded /
(%2F
) are the problem, but I don't know how to fix this.
Solution is the encoded slashes directive of Apache, as per @CBroe's comment: https://httpd.apache.org/docs/2.4/mod/core.html#allowencodedslashes