1

I'm setting a index.php script that will take sent POST requests, but when sending such requests the trailing slash is added through a 301 redirect and the POST data is lost.

For instance:

  1. POST request is made to host/test

  2. Server redirects to host/test/

  3. POST data is lost

Note that the request MUST be sent to host/test, not to host/test/.

To fix this, I either need to:

  • Make so that the POST data is passed along to the redirected url (using the SESSION didn't work as the redirect happens before the script is read)

  • Stop the automatic redirect that adds the trailing slash from happening (already tried messing with DirectorySlash Off on .htaccess, didn't work)

  • Something else

Please point me in the right direction.

H. Soda
  • 11
  • 3
  • OK. So what is your question? – Jay Blanchard Aug 14 '18 at 19:22
  • 1
    I very much doubt that a redirection rule will add a backslash to some URL. A slash, sure, but not a backslash. Except of course if you explicitly coded that. – arkascha Aug 14 '18 at 19:22
  • Thanks! I mean the slash at the end of the URL. It's added automatically by the server, i.e. when requesting "host/test" it redirects to "host/test/" and thus POST data is lost. AFAIK it's default behavior for apache – H. Soda Aug 14 '18 at 19:31
  • See https://serverfault.com/questions/250161/how-do-i-remove-trailing-slashes-from-a-url-when-using-apaches-default-director – BadHorsie Aug 27 '20 at 15:19

0 Answers0