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 Aktualisierungen per RSS | E-Mail Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: Wie ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Wie leicht verhindern den Zugriff auf einen Ordner mit htaccess

Posted on 17. Gesendet am 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Juli 2009 von Dragos in 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). An einem Projekt arbeiten jetzt war ich auf der Suche nach einer Lösung für einen Ordner mit Vorlage php Dateien zu schützen (einschließlich größere Dateien). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Eine Lösung wäre, um den Ordner chmod auf externe Einmischung eines neugierigen Augen zu vermeiden. 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. Aber die Arbeit mit Features von Apache habe ich herausgefunden, dass es günstiger ist die Verwendung der mod_rewrite Funktion, um Zugriff auf einen Ordner und dessen Inhalt zu leugnen. Here's the solution. Hier ist die Lösung. In my case the folder I was trying to protect was templates so my code looked as following (simplified): In meinem Fall den Ordner habe ich versucht, zu schützen, war Vorlagen so mein Code sah wie folgt (vereinfacht):


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: In Verbindung stehende Pfosten:

  1. PHP: Get all files and folders from a directory (folder) PHP: Holen Sie sich alle Dateien und Ordner aus einem Verzeichnis (Ordner)

    blog comments powered by Disqus Blog-Kommentare powered by Disqus