Reputation: 271
Here's the Scenario, I have a sample link that looks like this Let's say ProjectName/products.php
I was able to rename the URL in htaccess to make it look like: ProjectName/products
HTACCESS:
RewriteEngine On
RewriteRule ^products?$ products.php
My question is, is it possible to deny access when trying to enter URL ProjectName/products.php ? I'm new in htaccess. I've tried adding deny from all, yes it solved the problem of not accessing that php file but it happens that I also can't access now the cleaned URL, I hope i made my question clear. thanks for the help.
Upvotes: 0
Views: 676
Reputation: 41219
To deny external access to the php file, you can use the following rule :
RewriteEngine on
RewriteCond %{THE_REQUEST} /products\.php [NC]
RewriteRule ^ - [R=403,L]
Upvotes: 1