We're building an API and I'm working on the rewriterule of my htaccess to make our URL like this example.com/student/user/parameter1/parameter2.
Everything is working fine until I caught a problem:
The parameter2 consists of random alphanumeric and special characters, and it also includes a forward slashes (/). So whenever we're running the endpoint and captures the parameters, the values are wrong because it's reading the slashes within the parameter
Example: example.com/student/user/anna/a!p=/dfa
- Expected result should be
parameter1isannaandparameter2isa!p=/dfa - What's happening is
parameter1isa!p=andparameter2isdfa
I'm hoping somebody would give me an idea on how to fix this.
This is our current .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^student/user/(.*)/(.*)$ api/studentuser.php?name=$1&token=$2 [L]