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 Päivitykset RSS | Sähköposti Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Etusivu / Apache & mod_rewrite / koodaus / Apache-ModRewrite: Miten ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kuinka helposti kieltää pääsy kansion htaccess

Posted on 17. Postitettu 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Heinäkuu, 2009 Dragos on 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). Työskentelee projektin nyt olin etsinyt ratkaisua suojata kansio, joka sisältää mallin PHP-tiedostot (sisältää suurempia tiedostoja). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Yksi ratkaisu olisi chmod kansioon välttää ulkoisen sekaantumisesta yksi on utelias silmissä. 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. Mutta työskentelevät Apachen ominaisuuksia sain selville, että se on helpompi käyttää mod_rewrite ominaisuutta evätä pääsy kansio ja sen sisältö. Here's the solution. Tässä on ratkaisu. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Minun tapauksessani kansio yritin suojella oli malleja niin minun koodi näytti seuraava (yksinkertaistettu):


Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]

Translate this post Käännä tämä viesti


Related posts: Liittyvien virkojen:

  1. PHP: Get all files and folders from a directory (folder) PHP: Hanki kaikki tiedostot ja kansiot hakemisto (kansio)

    blog comments powered by Disqus blogin kommentit powered by Disqus