Introduction
Some customers may want to limit access to file extensions; the following example is how you can do so via cPanel/WHM using the Includes Editor.
Procedure
1. In WHM >> Service Configuration >> Apache Configuration >> Include Editor >> Pre VirtualHost Include >> All Versions
How to Edit the Apache Configuration File
You will want to add the following code for a single file (replacing <ext> with the extension you wish to disable access to)
<Files ~ "\.<ext>$">
Order allow,deny
Deny from all
</Files>
or for multiple extensions (replacing <ext#> with the extensions followed by | between each new extension)
<FilesMatch "\.(<ext1>|<ext2>)$">
Order Allow,Deny
Deny from all
</FilesMatch>
2. You may also need to make sure to disable the DirectoryIndex Priority for each of the disabled extensions to prevent Apache's built-in Priority Indexing of any disabled extensions.
(WHM >> Service Configuration >> Apache Configuration >> DirectoryIndex Priority)
Comments
0 comments
Article is closed for comments.