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 Ενημέρωση μέσω RSS | Email Get updates via feedburner Get updates via twitter
Home / Apache & mod_rewrite / Coding / Apache & ModRewrite: How… Αρχική Σελίδα / Apache & mod_rewrite / Κωδικοποίηση / Apache & ModRewrite: Πώς ...

Apache & ModRewrite: How to easily deny access to a folder with htaccess Apache & ModRewrite: Πώς να αρνηθεί την εύκολη πρόσβαση σε ένα φάκελο με htaccess

Posted on 17. Καταχωρήθηκε στις 17. Jul, 2009 by Dragos in Apache & mod_rewrite , Coding Ιούλιος, 2009 από Dragos σε 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). Που εργάζονται για ένα έργο τώρα έψαχνα για μια λύση για την προστασία της ένα φάκελο που περιέχει το πρότυπο php αρχεία (περιλαμβάνει σε μεγαλύτερα αρχεία). One solution would be to chmod the folder to avoid external meddling of one's curious eyes. Μία λύση θα ήταν να chmod το φάκελο για να αποφεύγετε την εξωτερική ανάμιξη της περίεργα μάτια του. 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. Αλλά εργάζονται με τα χαρακτηριστικά του Apache έμαθα ότι είναι πιο βολικό να χρησιμοποιήσετε το mod_rewrite δυνατότητα να αρνηθεί την πρόσβαση σε ένα φάκελο και το περιεχόμενό της. Here's the solution. Εδώ είναι η λύση. In my case the folder I was trying to protect was templates so my code looked as following (simplified): Στην περίπτωσή μου το φάκελο μου προσπαθούσε να προστατεύσει ήταν πρότυπα ώστε κωδικό μου φαινόταν ως εξής (απλουστευμένη):


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

Translate this post Μεταφράστε αυτήν την θέση


Related posts: Σχετικές θέσεις:

  1. PHP: Get all files and folders from a directory (folder) PHP: Βρείτε όλα τα αρχεία και τους φακέλους από έναν κατάλογο (φάκελο)

    blog comments powered by Disqus blog παρατηρήσεις που κινούνται με Disqus