Closed iRedds closed 1 year ago
The form tag should be <form action="/handler" method="post">
.
This is just an example to reproduce. Otherwise, in the documentation, you can write "do not use a trailing slash in the URL" and remove the redirect rule in .htaccess
I believe the rewrite rule is for cases where the end user has added a trailing slash to the URL.
PHP Version
7.4
CodeIgniter4 Version
latest
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
No response
What happened?
If the request matches the conditions of the redirect, then the response code 301 is used. If the request was made using a non-GET method, then the redirect will use the GET method to access the resource, which breaks the application.
Steps to Reproduce
Because of the trailing slash in the URL, Apache will redirect, but using the GET method, which will cause a 404 error: Can't find a route for 'get: handler'.
Expected Output
Correct redirect.
Anything else?
If you replace the response code with 308 (similar to 301, that is, permanently), then the redirect will be made using the HTTP method of the original request.