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]
Related posts: Σχετικές θέσεις:












































