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 7月、2009年のApacheのドラゴシュ &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. 1つのソリューションいずれかの好奇の目に、外部干渉を避けるためにフォルダを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を使用すると便利であることが、Apacheの機能での作業。 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:関連記事:












































