How can I allow directory listing in Apache for a specific (root) folder and its subfolders, but without showing a link to parent of that root folder. When user is in a subfolder, the 'Parent Directory'link is displayed to navigate to its parent, but when user is at the root folder I need to remove/hide this 'Parent Directory' link so that user cannot move above that 'root' hierarchy.
You can hide the "Parent Directory" link by adding the following to your .htaccess file:
IndexIgnore ..
But this will hide it for every directory.
If you have access to the httpd-configs you could try to remove the directive from per-server context:
<DirectoryMatch "^/(?!var/www/your-root/subfolder)">
...
</DirectoryMatch>
As long as there is no IndexIgnore directive in an higher folder it should work for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With