Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache और ModRewrite: कैसे आसानी से एक फ़ोल्डर का उपयोग करने से इनकार करने htaccess
Posted on 17. 17 पर तैनात हैं. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding जुलाई, 2009 अपाचे में Dragos और 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). एक परियोजना पर कार्य अभी मैं एक समाधान के लिए देख रहा था के लिए एक php फ़ाइलें टेम्पलेट वाले फ़ोल्डर की रक्षा (बड़ी फ़ाइलों में शामिल हैं). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. एक समाधान के लिए फ़ोल्डर chmod को एक उत्सुक आँखों के बाहरी दखल से बचना होगा. 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]
Related posts: संबंधित पोस्ट:












































