Reputation: 59
Problem with htaccess files permission.
I have few files with .php extension in root folder which can be accessed in website as example.com/myprofile.php
I have another file(myprofileservice.php) in directory(service) as: example.com/service/myprofileservice.php
This myprofileservice.php will provide necessary information from backend when url: example.com/myprofile.php
is accessed in browser.
I want to disable viewing php files but only for directory "service" not the root.
Preventing .php file access by rule
RewriteRule .*\.(php)$ - [F,NC]
prevents the example.com/myprofile.php
itself to load , which is incorrect
Upvotes: 2
Views: 391
Reputation: 41219
Try :
RewriteRule ^service/myprofileservice.php$ - [F,L]
This will forbid access to a single php file service/myprofileservice.php .
Upvotes: 1