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 Updates via RSS | E-post Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Avaleht / Apache & mod_rewrite / kodeerimise / Apache & ModRewrite: Kuidas ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kuidas lihtne keelata juurdepääsu kausta htaccess

Posted on 17. Postitatud 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Juuli, 2009 Dragos on Apache ja mod_rewrite, kodeerimise

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Töö projekti kallal kohe Ma otsisin, et kaitsta kaust malli php failid (ka suuremad failid). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Üks lahendus oleks chmod folder vältida välise sekkumise ühe's uudishimulik silmad. 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. Aga töötavad Apache funktsioonide sain teada, et see on mugavam kasutada mod_rewrite funktsiooni keelata juurdepääs kausta ja selle sisu. Here's the solution. Siin on lahendus. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Minu puhul kausta püüdsin kaitsta oli malle nii et minu kood tundus pärast (lihtsustatud):


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

Translate this post Tõlgi see postitus


Related posts: Seonduvad postitused:

  1. PHP: Get all files and folders from a directory (folder) PHP: Get kõik failid ja kaustad kataloogi (kausta)

    blog comments powered by Disqus blog comments powered by Disqus