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