After using header('Location:employees');exit;
after a POST
, I was somehow redirected instead to localhost/project_name/employees/
. Even if my <a>
points to just employees
<a href="employees" role="button" class="col-1 my-1 mr-1 btn btn-outline-primary btn-sm">Employee</a>
I'm always redirected to employees/
. This does not happen to the other links, and if I use employee
, I'm being redirected correctly, no trailing slash being added. I suspect it is because of my .htaccess
, but it does not affect other link.
Here's my .htaccess
:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
Even if I delete the contents, it still adds a trailing slash to employees
. I already tried clearing the browser's data and opening it in another browser (Microsoft Edge), still the same result.
I tried updating htaccess
with the answer here, but still no success
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
I also tried clearing all the contents of employees.php
just to see if it because of my codes, but the problem still persist.
How can I prevent this from happening to the other links? I can't seem to reverse it, and the solution that I managed to find is to just change the name. Although it is not a problem, I want to know the cause of this.