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 Updates via RSS | Email Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache & mod_rewrite / kodim / Apache & ModRewrite: Si ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Si të lehtë të refuzojë qasje në një dosje me htaccess

Posted on 17. Dërguar të 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Korrik, 2009 nga DragosApache & mod_rewrite, shifrim

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Duke punuar në një projekt tani isha duke kërkuar për një zgjidhje për të mbrojtur një dosje që përmban fotografi php template (përfshin në dosjet më të mëdha). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Një zgjidhje do të ishte të chmod dosje për të shmangur ndërhyrja e jashtme e sytë e kureshtar. 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. Por pune e Apache me tiparet e kuptova se ai është më i përshtatshëm për të përdorur mod_rewrite funksion të refuzojë qasje në një dosje dhe përmbajtjen e saj. Here's the solution. Ja zgjidhje. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Në rastin tim dosje isha duke u përpjekur për të mbrojtur të ishte templates aq kodin tim dukej si vijon (simplified):


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

Translate this post Translate this post


Related posts: Related posts:

  1. PHP: Get all files and folders from a directory (folder) PHP: Merrni të gjitha dosjet dhe dosjet nga një në dosjen (folder)

    blog comments powered by Disqus Komentet blog powered by Disqus