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 Aktualizáciou cez RSS | E-mail Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache mod_rewrite & / Kódovanie / Apache & ModRewrite: Ako ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Ako jednoducho zakázať prístup do priečinka s htaccess

Posted on 17. Publikované pred: dňa 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Júla 2009 od Dragos v Apache & mod_rewrite, Kódovanie

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áca na projekte, teraz som hľadal riešenie pre ochranu priečinok obsahujúci šablónu php súbory (obsahuje vo väčších súborov). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Jedným z riešení by bolo chmod zložky, aby sa zabránilo vonkajšieho zasahovania niečieho zvedavý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áca s funkciami Apache som zistil, že je výhodnejšie použiť funkciu mod_rewrite odoprieť prístup k zložku a jej obsah. Here's the solution. Tu je riešenie. In my case the folder I was trying to protect was templates so my code looked as following (simplified): V mojom prípade zložky som sa snažil chrániť bola šablón, takže môj kód vyzeral, ako tieto (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: Súvisiace príspevky:

  1. PHP: Get all files and folders from a directory (folder) PHP: Get všetkých súborov a priečinkov z adresára (zložky)

    blog comments powered by Disqus blog pripomienky powered by Disqus