Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kako se lahko zavrne dostop do mape z htaccess
Posted on 17. Objavljeno dne 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Julij 2009, ki ga Dragos v Apache & mod_rewrite, Coding
Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Delo na projektu zdaj sem iskal rešitev za varstvo mapo, ki vsebuje predloge php datotek (tudi v večjih datotek). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Ena od rešitev bi bila chmod mapo, da bi se izognili zunanje vmešavanje v enega radovednimi očmi. 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. Ampak delo z značilnostmi Apache's sem izvedel, da je bolj smotrno uporabiti mod_rewrite funkcijo onemogočiti dostop do mapo in njeno vsebino. Here's the solution. Tu je rešitev. In my case the folder I was trying to protect was templates so my code looked as following (simplified): V mojem primeru sem bil težaven mapo za zaščito bil predlog, da moja koda videti, kot sledi (poenostavljena):
Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]
Related posts: Podobni objav:












































