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 Aktualizací přes RSS | E-mail Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache mod_rewrite & / Kódování / Apache & ModRewrite: Jak ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Jak jednoduše zakázat přístup do složky s htaccess

Posted on 17. Publikováno před: dne 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Července 2009 od Dragos v Apache & mod_rewrite, Kódování

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Práce na projektu, teď jsem hledal řešení pro ochranu složku obsahující šablonu php soubory (obsahuje ve větších souborů). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Jedním z řešení by bylo chmod složky, aby se zabránilo vnějšího vměšování něčího zvědavých očí. 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. Ale práce s funkcemi Apache jsem zjistil, že je výhodnější použít funkci mod_rewrite odepřít přístup k složku a její obsah. Here's the solution. Tady je řešení. In my case the folder I was trying to protect was templates so my code looked as following (simplified): V mém případě složky jsem se snažil chránit byla šablon, takže můj kód vypadal, jako následující (zjednodušené):


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

Translate this post Translate this post


Related posts: Související příspěvky:

  1. PHP: Get all files and folders from a directory (folder) PHP: Get všech souborů a složek z adresáře (složky)

    blog comments powered by Disqus blog připomínky powered by Disqus