Reputation: 341
I'm building a very simple API, but I want to block direct access to php files.
My current .htaccess looks like this:
RewriteEngine on
Options +FollowSymlinks
RewriteBase /
RewriteRule ^api/(.*) $1.php/ [L]
So if i go to www.website.com/api/register it should call the register.php file. This works fine, but I want to block somebody from giong to www.website.com/register.php.
Upvotes: 1
Views: 1127
Reputation: 11856
Add an
RewriteRule (.*)\.php /$1 [L,R=301]
before your current rule
Upvotes: 2