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 Aktualizacje pocztą RSS | Email Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Strona główna / Apache i mod_rewrite / Coding / Apache & ModRewrite: Jak ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Jak łatwo odmówić dostępu do folderu z htaccess

Posted on 17. Zamieszczone w dniu 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Lip, 2009 Dragos w Apache i mod_rewrite, Coding

Working on a project right now I was looking for a solution to protect a folder containing template php files (includes in larger files). Praca nad projektem w tej chwili ja szukałem rozwiązania do ochrony folder zawierający szablon php plików (w tym w większych plików). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Jednym z rozwiązań byłoby chmod folderu, aby uniknąć zewnętrznych wtrącanie własnego ciekawe oczy. 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 współpraca z funkcji Apache dowiedziałem się, że jest to bardziej wygodne w użyciu mod_rewrite funkcji odmówić dostępu do folderu i jego zawartości. Here's the solution. Oto rozwiązanie. In my case the folder I was trying to protect was templates so my code looked as following (simplified): W moim przypadku folderu starałem się chronić był szablony kod wyglądał tak jak po (uproszczony):


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: Podobne posty:

  1. PHP: Get all files and folders from a directory (folder) PHP: Wszystkie pliki i foldery z katalogu (folderu)

    blog comments powered by Disqus blog komentarze powered by Disqus