I want the htaccess file to rewrite url to include .php
extension in the url if the php file exists otherwise, leave it be for other rules to handle. For example:
domain.com/page -> domain.com/page.php (page.php exists)
I tried these codes but they’re not working
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{THE_REQUEST} (.*).php
RewriteRule ^(.*)$ $1.php [L]
And
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L]