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 FRISSÍTÉSEK VIA RSS | E-mail Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache + mod_rewrite / Kódolás / Apache + ModRewrite: Hogyan ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Hogyan lehet egyszerűen megtagadja a hozzáférést egy mappát htaccess

Posted on 17. Posted on 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Július, 2009 Dragos az Apache + mod_rewrite, Coding

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Dolgozik egy projekten, most kerestem a megoldást is védeni mappát tartalmazó sablon php fájlokat (beleértve a nagyobb fájlok). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Az egyik megoldás az lenne, hogy a mappa chmod, hogy elkerüljék a külső beavatkozásnak az egyén kíváncsi szemek. 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. De a munka Apache vonásait rájöttem, hogy kényelmesebb a mod_rewrite funkciót megtagadják a mappát és annak tartalmát. Here's the solution. Itt van a megoldás. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Az én esetemben a mappát akartam védeni volt sablonokat úgy nézett ki, mint a kódomat következő (egyszerűsített):


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: Vedd meg a fájlok és mappák egy könyvtár (mappa)

    blog comments powered by Disqus iPhone Disqus szerint