dsaba Posted December 20, 2007 Share Posted December 20, 2007 how can I restrict access to files within a specific folder that have a specific file extension with .htaccess? for example: dir of /files/ file.pdf otherfile.pdf thatfile.pdf index.html anotherpage.php anotherpage2.html in the /files/ directory i want to only allow access to every file that is not '.pdf' so the only publicly accessible files will be: index.html anotherpage.php anotherpage2.html Link to comment https://forums.phpfreaks.com/topic/82566-restrict-access-to-all-files-within-folder-with-a-specific-extension/ Share on other sites More sharing options...
trq Posted December 21, 2007 Share Posted December 21, 2007 <Files ~ "pdf$"> Order allow,deny Deny from all </Files> Link to comment https://forums.phpfreaks.com/topic/82566-restrict-access-to-all-files-within-folder-with-a-specific-extension/#findComment-420035 Share on other sites More sharing options...
dsaba Posted December 21, 2007 Author Share Posted December 21, 2007 great it works but it restricts my server ip from accessing the files too how can I restrict the access only for ips that are not my host, aka remote access ? Link to comment https://forums.phpfreaks.com/topic/82566-restrict-access-to-all-files-within-folder-with-a-specific-extension/#findComment-420355 Share on other sites More sharing options...
trq Posted December 25, 2007 Share Posted December 25, 2007 <Files ~ "pdf$"> Order allow,deny Deny from all Allow from 127.0.0.1 </Files> Link to comment https://forums.phpfreaks.com/topic/82566-restrict-access-to-all-files-within-folder-with-a-specific-extension/#findComment-423091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.