How can I deny direct access to a URL through .htaccess
file?
The URL for example is
www.example.com/course/reset-password
The file is located within a course
folder and the alternative and all files in that folder can allow direct access with exception of reset-password.php
.
2
Answers
Inside
corse/.htacccess
you can have just this rule to block access:If you wish to deny access to a specific file (as opposed to a URL) then consider using mod_authz_core (Apache 2.4) instead of mod_rewrite. For example:
This has less chance of being overridden than mod_rewrite.