HOW TO MANAGE SUB-DIRECTORY PERMISSIONS IN APACHE

May 13, 2019   /   by Marco  / Categories :  Business, Technology, Websites
Business Legions - HOW TO MANAGE SUB-DIRECTORY PERMISSIONS IN APACHE

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

DO YOU LIKE WHAT YOU'VE READ?
Join our subscription list and receive our content right in your mailbox. If you like to receive some Great deals our Freebies then subscribe now!

Our Sponsors

  • Follow us:

OTHER ARTICLES YOU MAY LIKE


USING CHROME AND GOOGLE LENS TO SEARCH FOR IMAGES

USING CHROME AND GOOGLE LENS TO SEARCH FOR IMAGES

Learn how to efficiently search for images on a website using Google Lens through Chrome. Chrome enhances the search experience using the revolutionary Google Lens technology, enabling users to conduct quick image searches with remarkable ease. By incorporating image recognition algorithms, Google Lens empowers users to identify objects, landmarks, and products depicted in images accurately […]

read more
WHATSAPP HACK TO INCREASE NUMBER OF PINNED CHATS

WHATSAPP HACK TO INCREASE NUMBER OF PINNED CHATS

WhatsApp is one of the most popular messaging apps in the world, with over 2 billion users globally. One of the features that users love is the ability to pin important chats to the top of their chat list for easy access. However, WhatsApp currently limits the number of chats that can be pinned to […]

read more

Like our Page