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 Оновлення через RSS | Email Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Головна / Apache mod_rewrite & / кодування / Apache & ModRewrite: Як ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Як легко відмовити в доступі до папки з Htaccess

Posted on 17. Опублікований 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Липень, 2009 Dragos в Apache & mod_rewrite, кодування

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Робота над проектом зараз я шукав рішення для захисту папки шаблонів PHP файлів (входить у великих файлів). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Одним з рішень було б CHMOD папку, щоб уникнути зовнішнього втручання у свої цікаві очі. 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. Але робота з функціями сервера Apache я з'ясував, що це більш зручно використовувати функцію mod_rewrite заборонити доступ до папки та її зміст. Here's the solution. Ось рішення. In my case the folder I was trying to protect was templates so my code looked as following (simplified): У моєму випадку папка Я намагався захистити було шаблонів, так мій код виглядав так наступне (спрощене письмо):


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

Translate this post Перекласти цю посаду


Related posts: Схожі повідомлення:

  1. PHP: Get all files and folders from a directory (folder) PHP: Отримати всі файли і папки з каталогу (каталог)

    blog comments powered by Disqus Блог коментарі сила Disqus