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 UPDATES VIA RSS | Email Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: Paano ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Paano upang madaling tanggihan ng access sa isang folder na may htaccess

Posted on 17. Posted on 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Hulyo, 2009 sa pamamagitan ng Dragos sa Apache & 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). Paggawa sa isang proyekto sa ngayon ako ay naghahanap ng isang solusyon upang maprotektahan ang isang folder na naglalaman ng template php file (kabilang sa mga mas malalaking files). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Isang solusyon ay sa chmod ang folder upang maiwasan ang mga panlabas na himasok ng isa sa pangkaraniwang mga mata. 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. Subalit ang nagtatrabaho sa Apache katangian ko nalaman na ito ay mas maginhawang gamitin ang tampok na mod_rewrite upang tanggihan ng access sa isang folder at ang mga nilalaman nito. Here's the solution. Narito ang solusyon. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Sa aking kaso ang folder na ako ay nagsisikap upang protektahan ang mga template para sa aking code ay tumingin ng mga sumusunod na (pinasimple):


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

Translate this post Isalin ang post na ito


Related posts: Related posts:

  1. PHP: Get all files and folders from a directory (folder) PHP: Kumuha ng lahat ng mga file at mga folder ng mula sa isang direktoryo (folder)

    blog comments powered by Disqus blog comments powered by Disqus