<input type="hidden" id="_wpnonce" name="_wpnonce" value="7cae591523" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/27138" /><input type="hidden" id="_wpnonce" name="_wpnonce" value="7cae591523" /><input type="hidden" name="_wp_http_referer" value="/blog/wp-json/wp/v2/posts/27138" />{"id":27138,"date":"2019-05-13T22:12:17","date_gmt":"2019-05-13T12:12:17","guid":{"rendered":"https:\/\/www.businesslegions.com\/blog\/?p=27138"},"modified":"2019-05-13T22:13:42","modified_gmt":"2019-05-13T12:13:42","slug":"how-to-manage-sub-directory-permissions-in-apache","status":"publish","type":"post","link":"https:\/\/www.businesslegions.com\/blog\/2019\/05\/13\/how-to-manage-sub-directory-permissions-in-apache\/","title":{"rendered":"HOW TO MANAGE SUB-DIRECTORY PERMISSIONS IN APACHE"},"content":{"rendered":"<!--CusAds0--><p>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:<\/p>\n<p><em>NOTE: I&#8217;m using VestaCP, an open source control panel for web hosting so these steps may not work for you<\/em><\/p>\n<p>Copy and the default.stpl and default.tpl files in\u00a0\/usr\/local\/vesta\/data\/templates\/web\/httpd\/ e.g default-modified.stpl\u00a0\u00a0(I decided to do this since the https.conf file gets rewritten every time I modify the website config via the VestaCP dashboard)<\/p>\n<p>Edit the copied files and add the following:<\/p><!--CusAds0-->\n<pre class=\"lang:default decode:true\">&lt;Directory %docroot%\/home\/folder1&gt;\r\nOrder deny,allow\r\ndeny from all\r\nallow from x.x.x.x\r\n&lt;\/Directory&gt;\r\n\r\n&lt;Directory %docroot%\/home\/folder1\/folder2\/&gt;\r\nAllow from all\r\n&lt;\/Directory&gt;<\/pre>\n<p>Restart the httpd service using<\/p>\n<pre class=\"lang:default decode:true\">service httpd restart<\/pre>\n<p>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<\/p>\n<div class=\"lt-box\" style=\"border:1px solid #1d6a9e\"><div class=\"lt-box-title\" style=\"background-color:#2485C6;border-top:1px solid #a7cee8;text-shadow:1px 1px 0 #0b283b\">DO YOU LIKE WHAT YOU'VE READ?<\/div><div class=\"lt-box-content\">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!\r\n\r\n<p><div class=\"tnp tnp-subscription \">\n<form method=\"post\" action=\"https:\/\/www.businesslegions.com\/blog\/wp-admin\/admin-ajax.php?action=tnp&amp;na=s\">\n<input type=\"hidden\" name=\"nlang\" value=\"\">\n<div class=\"tnp-field tnp-field-firstname\"><label for=\"tnp-1\">Name<\/label>\n<input class=\"tnp-name\" type=\"text\" name=\"nn\" id=\"tnp-1\" value=\"\" placeholder=\"\"><\/div>\n<div class=\"tnp-field tnp-field-email\"><label for=\"tnp-2\">Email<\/label>\n<input class=\"tnp-email\" type=\"email\" name=\"ne\" id=\"tnp-2\" value=\"\" placeholder=\"\" required><\/div>\n<div class=\"tnp-field tnp-field-button\" style=\"text-align: left\"><input class=\"tnp-submit\" type=\"submit\" value=\"Subscribe\" style=\"\">\n<\/div>\n<\/form>\n<\/div>\n<\/p>\r\n\r\n<\/div><\/div><!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>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&#8217;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\u00a0\/usr\/local\/vesta\/data\/templates\/web\/httpd\/ [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":27147,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,3,1043],"tags":[1607,6462,1906,1660,6461,1968],"class_list":["post-27138","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-business","category-technology","category-websites","tag-apache","tag-dashboard","tag-folder","tag-permissions","tag-subdirectory","tag-vestacp"],"_links":{"self":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/27138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/comments?post=27138"}],"version-history":[{"count":1,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/27138\/revisions"}],"predecessor-version":[{"id":27148,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/posts\/27138\/revisions\/27148"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media\/27147"}],"wp:attachment":[{"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/media?parent=27138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/categories?post=27138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.businesslegions.com\/blog\/wp-json\/wp\/v2\/tags?post=27138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}