How to deny access to a directory in .htaccess?

by arnoldo.moen , in category: Third Party Scripts , 7 months ago

How to deny access to a directory in .htaccess?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by raphael_tillman , 7 months ago

@arnoldo.moen 

You can deny access to a directory using the following code in your .htaccess file:

1
2
3
<Directory /path/to/directory>
    Deny from all
</Directory>


Replace /path/to/directory with the path to the directory you want to deny access to. This code will block all users from accessing the files within that directory.

Related Threads:

How to deny access to a file name in .htaccess?
How to exclude a directory from .htaccess rewrite?
How to use host root directory in .htaccess?
How to change base directory properly in .htaccess?
How to disallow access to a subdomain using .htaccess?
How to block folder access to ftp with .htaccess?