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 التحديثات عن طريق آر إس إس | البريد الالكتروني Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… الوطن / اباتشى & mod_rewrite / الترميز / اباتشى & ModRewrite : كيف...

Apache & ModRewrite: How to easily deny access to a folder with htaccess اباتشي & ModRewrite : كيفية منع الوصول بسهولة إلى مجلد مع هتكس

Posted on 17. نشر في 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding يوليو ، 2009 من قبل دراكوش في اباتشي & mod_rewrite ، ترقيمها

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). العمل على المشروع حاليا كنت تبحث عن حل لحماية مجلد يحتوي على ملفات قالب مضحك) يتضمن في ملفات أكبر). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. حل واحد سيكون لتغير صلاحيات المجلد لتجنب تدخل خارجي واحد من أعين الفضوليين. 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. ولكن العمل مع اباتشي ميزات اكتشفت أنه أكثر ملاءمة لاستخدام هذه الميزة mod_rewrite لمنع الوصول إلى مجلد ومضمونها. Here's the solution. وهنا يكمن الحل. In my case the folder I was trying to protect was templates so my code looked as following (simplified): في حالتي المجلد الأول كان يحاول حماية والقوالب حتى بدا لي مدونة على النحو التالي (المبسطة) :


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

Translate this post ترجمة هذه الوظيفة


Related posts: الوظائف ذات الصلة :

  1. PHP: Get all files and folders from a directory (folder) [فب] : احصل على جميع الملفات والمجلدات من دليل (مجلد)

    blog comments powered by Disqus بلوق التعليقات مدعوم من ديسقوس]