Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kā viegli liegt mapē ar htaccess
Posted on 17. Posted on 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Jūl, 2009 by Dragos ar 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). Strādā pie projekta šobrīd es meklēju risinājumu, lai aizsargātu mapi, kurā veidnes php failus (ietver lielākus failus). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Viens risinājums būtu chmod mapi, lai izvairītos no ārējo iejaukšanos no kādu dīvainu acīm. 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. Bet strādājot ar Apache funkcijām Es atklāju, ka tā ir ērtāk izmantot mod_rewrite līdzekli, lai liegtu piekļuvi mapi un tās saturu. Here's the solution. Šeit ir risinājums. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Manā gadījumā mapi es centos aizsargāt bija veidnes, lai mana koda izskatījās, šādas (vienkāršotā):
Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]
Related posts: Related posts:












































