Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Nasıl kolayca bir klasöre erişimi reddetmek için htaccess
Posted on 17. 17 tarihinde gönderildi. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Temmuz, 2009 Apache içinde Dragos & mod_rewrite, Kodlama tarafından
Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Çalışan bir proje üzerinde şu anda bir çözüm için bir klasör php şablon dosyalarını içeren korumak için (büyük dosyaları) içerir bakıyordu. One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Bir çözüm kişinin meraklı gözlerin dış karışma önlemek için klasör chmod olacaktır. 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. Ama daha bir klasör ve içeriğine erişimi reddetmek için mod_rewrite özelliğini kullanmak daha uygun olduğunu buldum Apache özellikleri ile çalışma. Here's the solution. İşte çözüm. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Benim durumumda klasörü Ben korumak olarak çalışıyordu şablonları bu kadar kodu (basitleştirilmiş) aşağıdaki gibi baktı:
Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]
Related posts: Ilgili posta:












































