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 Actualizări prin RSS | E-mail Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache & mod_rewrite / codificare a mărfurilor / Apache & ModRewrite: Cum ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Cum de a nega cu uşurinţă accesul la un dosar cu htaccess

Posted on 17. Postat la data de 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Iulie, 2009 de către Dragos în Apache & mod_rewrite, de codificare a mărfurilor

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Lucra la un proiect, chiar acum am fost căutat de o soluţie pentru a proteja un dosar care conţine fişiere şablon PHP (include, în fişiere mai mari). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. O soluţie ar fi să chmod dosarul pentru a se evita amestecul externe a ochii curios. 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. Dar, de lucru cu caracteristici Apache am aflat că este mai convenabil să utilizeze mod_rewrite caracteristica de a refuza accesul la un folder şi conţinutul său. Here's the solution. Iată soluţia. In my case the folder I was trying to protect was templates so my code looked as following (simplified): În cazul meu pliant Am încercat să protejeze template-uri a fost atât de codul meu uitat după cum urmează (Simplified):


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

Translate this post Traduceţi acest post


Related posts: Legate de posturi:

  1. PHP: Get all files and folders from a directory (folder) PHP: Get toate fişierele şi folderele de la un director (folder)

    blog comments powered by Disqus comentarii blog-ul creat de Disqus