HOW TO MANAGE SUB-DIRECTORY PERMISSIONS IN APACHE
May 13, 2019 / by Marco / Categories : Business, Technology, Websites
If you want to set permissions for subdirectories e.g restrict public access to /home/folder1/ but allow access to /home/folder1/folder2 then this is one way of doing it:
NOTE: I’m using VestaCP, an open source control panel for web hosting so these steps may not work for you
Copy and the default.stpl and default.tpl files in /usr/local/vesta/data/templates/web/httpd/ e.g default-modified.stpl (I decided to do this since the https.conf file gets rewritten every time I modify the website config via the VestaCP dashboard)
Edit the copied files and add the following:
<Directory %docroot%/home/folder1> Order deny,allow deny from all allow from x.x.x.x </Directory> <Directory %docroot%/home/folder1/folder2/> Allow from all </Directory>
Restart the httpd service using
service httpd restart
Test by accessing the two folders using a public IP address (e.g from your mobile phone) and the other from the static IP address x.x.x.x
OTHER ARTICLES YOU MAY LIKE

A SMALL BUTTON, A BIG MILESTONE: MY FIRST SUPER THANKS
Every creator has milestones that feel both modest and momentous. Your first upload. Your first comment. Your first subscriber. And then one day, among the usual notifications, a new one pops up: your first Super Thanks. Mine came from a generous viewer, Frank Castlenut, who left a donation of five dollars alongside a kind note. […]
read more
NEW RUNNING BELT ON TEST: FIRST IMPRESSIONS AND HONEST THOUGHTS
There’s a special kind of anticipation that comes with unboxing fresh kit, especially something as personal as a running belt. It’s the bit of gear that sits closest to you on every run, carrying your phone, keys, gels and—in this case—a water bottle, all while ideally disappearing from your awareness once you’re moving. Today’s subject […]
read more