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 Atnaujinimai Via RSS | E-mail Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Pradžia / Apache & mod_rewrite / Kodai / Apache & MODREWRITE: Kaip ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & MODREWRITE: Kaip lengvai neleisti susipažinti su aplanko su htaccess

Posted on 17. Posted on 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Liepa, 2009 Dragos į & Apache mod_rewrite, kodavimo

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Darbas projektu dabar aš ieškojau, siekiant apsaugoti aplanką, kuriame yra šablono PHP failus (įeina į didesnius failus). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Vienas iš sprendimų būtų chmod aplanką, kad būtų išvengta išorinio įsikišimo į savo smalsių akių. 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. Bet darbas su Apache savybių aš sužinojau, kad tai yra patogesnis naudoti mod_rewrite funkcija neleisti patekti į aplanką ir jo turinį. Here's the solution. Štai sprendimas. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Mano atveju aplanko aš bandžiau apsaugoti buvo šablonai, kad mano kodas atrodė taip (supaprastinta):


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: Gauti visus failus ir aplankus iš katalogo (aplanko)

    blog comments powered by Disqus Dienoraštis komentarus maitina Disqus