I'm using the apache2 web server to host my website. All of my php files are located in the /var/www/html/ directory. I also have a email server that stores emails in /var/www/html/contact. When accessing using an a tag to open contact.php from index.php, apache2 sends the browser to example.com/contact/ and not example.com/contact. I have a .htaccess file to ignore the .php file extension. I have tried deleting the contact directory to see if that was the issue, but same thing happens.
Heres my .htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
SetEnv TZ America/Indianapolis
I think your problem is that your file name and directory name is indentical. When server sees a request for /conctact it serves you the directory /contact instead of rewriting /contact to /contact.php. To avoid this, you need to turn off the DirectorySlash so that you can access /contact as a file.
DirectorySlash off
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
SetEnv TZ America/Indianapolis