Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Kako jednostavno onemogućiti pristup do mape s htaccess
Posted on 17. Poslano na 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Srp, 2009 by Dragos u i 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). Rad na projektu upravo sada sam bio obličje za rješenje za zaštitu mapu koja sadrži predložak php kartoteka (uključuje u većim datotekama). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Jedno rješenje bi bilo da chmod mapu da bi se izbjeglo uplitanje vanjskih nečije oči znatiželjnika. 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. Ali rad je sa Apache mogućnosti Otkrio sam da je više prikladan za korištenje mod_rewrite značajku onemogućiti pristup do mape i njezin sadržaj. Here's the solution. Ovdje je rješenje. In my case the folder I was trying to protect was templates so my code looked as following (simplified): U mom slučaju mapu Sam bio težak to štititi bio predloške tako da je moj broj izgledala kako slijedi (pojednostavljeni):
Options +FollowSymLinks
RewriteEngine on
#replace the word templates with the name of your own folder
RewriteRule ^/?templates/?(.*)?$ - [F,L]
Related posts: Related posts:












































