I'm trying to write a simple rule such that:
/page
gets implicitly routed to /page.php
. Inversely, I'd like any direct access to /page.php
to be redirected in the address bar to /page
.
Currently I have:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
But that does not handle the 2nd case. How can I modify it?