Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kuidas lihtne keelata juurdepääsu kausta htaccess
Posted on 17. Postitatud 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Juuli, 2009 Dragos on Apache ja mod_rewrite, kodeerimise
Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Töö projekti kallal kohe Ma otsisin, et kaitsta kaust malli php failid (ka suuremad failid). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Üks lahendus oleks chmod folder vältida välise sekkumise ühe's uudishimulik silmad. But working with Apache's features I found out that it is more convenient to use the mod_rewrite feature to deny access to a folder and its content. Aga töötavad Apache funktsioonide sain teada, et see on mugavam kasutada mod_rewrite funktsiooni keelata juurdepääs kausta ja selle sisu. Here's the solution. Siin on lahendus. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Minu puhul kausta püüdsin kaitsta oli malle nii et minu kood tundus pärast (lihtsustatud):
Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]
Related posts: Seonduvad postitused:












































