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: Bagaimana ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Cara mudah menolak akses ke folder dengan htaccess

Posted on 17. Dikirim di 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Jul, 2009 oleh Dragos dalam 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). Bekerja di sebuah proyek sekarang saya sedang mencari solusi untuk melindungi folder template berisi file php (termasuk dalam file yang lebih besar). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Salah satu solusinya adalah dengan chmod folder untuk menghindari campur tangan eksternal penasaran seseorang 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. Tetapi bekerja dengan fitur Apache saya menemukan bahwa lebih mudah untuk menggunakan fitur mod_rewrite untuk menolak akses ke folder dan isinya. Here's the solution. Berikut ini solusinya. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Dalam kasus saya, folder saya mencoba untuk melindungi adalah template sehingga kode saya tampak seperti berikut (disederhanakan):


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

Translate this post Terjemahkan posting ini


Related posts: Related posts:

  1. PHP: Get all files and folders from a directory (folder) PHP: Dapatkan semua file dan folder dari sebuah direktori (folder)

    blog comments powered by Disqus blog comments powered by DISQUS