This is a translated page. The original can be found here: http://iwebdevel.com/2009/07/17/apache-modrewrite-how-to-easily-deny-access-to-a-folder-with-htaccess/
UPDATES VIA RSS | Email AĠĠORNAMENTI VIA RSS | Email Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache & mod_rewrite / Kodifika / Apache & ModRewrite: Kif ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kif faċilment jiċħad l-aċċess għal folder ma htaccess

Posted on 17. Posted on 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Lulju, 2009 mill Dragos fil Apache & mod_rewrite, Kodifika

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Jaħdmu fuq proġett dritt issa I kien infittxu soluzzjoni li jipproteġu fowlder fih template fajls php (tinkludi fil-fajls akbar). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Soluzzjoni waħda tkun li chmod-folder biex jevitaw indħil estern ta 'l-għajnejn kurjużi wieħed. 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. Iżda ta 'ħidma ma' karatteristiċi Apache's sibt li huwa iktar konvenjenti li jintuża l-mod_rewrite karatteristika li jiċħad aċċess għal folder u l-kontenut tagħha. Here's the solution. Hawn is-soluzzjoni. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Fil-każ tiegħi l-folder I kien qed jipprova jipproteġi kien templates hekk kodiċi tiegħi ħares lejn kif ġej (simplifikata):


Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]

Translate this post Ittraduċi din il-kariga


Related posts: Related postijiet:

  1. PHP: Get all files and folders from a directory (folder) PHP: Get kollha fajls u folders minn direttorju (folder)

    blog comments powered by Disqus blog kummenti powered by Disqus