have this code in a htaccess file to hide the final php extension of each file
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
but now i want to redirect to another page if the user try to complete the extension.
i tried this line after the script above but i get a 500 internal error
RewriteRule \.php$ - [R=404]
thanks !
Have your rewrite rules like this:
Basically first rule is appending a dummy query parameter
myvar=0in the URL and second is checking its non-presence to kick in, hence if user types /abc.php then it is blocked but if just /abc then it is internally redirected to /abc.php.