I have the following API endpoints:
/api/project
/api/project/start
/api/project/end
These endpoints are supported by a file structure that looks like:
/api/project.php
/api/project/start.php
/api/project/end.php
I am currently using .htaccess
to make the .php
extension optional to the API user.
I noticed that if I hit /api/project
without the .php
extension, I get taken to the project
folder on Apache instead of the project.php
file.
Is there anyway to account for this in the .htaccess
file or through a different method?
My current .htaccess
rewrite rules
Options -Multiviews
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [NC,L]