Apache 2.4 access control uses `Require` directive. Sensitive files, backups, and upload folder executable extensions can be selectively blocked; IP allowlist should not be applied without proper configuration of real client IP behind reverse proxy/Cloudflare
403 Forbidden
Require all denied
client denied by server configuration
AH01630: client denied
Directory index forbiddenApache 2.4 access control uses `Require` directive. Sensitive files, backups, and upload folder executable extensions can be selectively blocked; IP allowlist should not be applied without proper configuration of real client IP behind reverse proxy/Cloudflare
Do not expect a `.htaccess` result without reserving the Apache, LiteSpeed, Plesk proxy or NGINX-only structure.
Back up the current file with the date; Find the directive and line in the Apache/LiteSpeed error log.
Do not change redirect, rewrite, header and access rules all at the same time.
Measure the status, Location, Content-Type and redirect number with curl and check the cache layers separately.
Do not use unconditional `Require all denied` at the site root.
Meaning: The sensitive configuration file is accessible over the web.
Possible cause: No access rules present or the server is NGINX-only.
Meaning: The uploaded malicious file is executable.
Possible cause: Script execution is enabled in the upload directory.
Meaning: The rule is in the wrong directory or uses a broad FilesMatch.
Possible cause: Scope error.
Meaning: Apache sees proxy IP.
Possible cause: No mod_remoteip or trusted proxy configuration.
Meaning: The origin access rule is incompatible with Cloudflare IPs.
Possible cause: The remote IP is incorrect.
Meaning: Options override permission is disabled.
Possible cause: AllowOverride Options yok.
Meaning: Order/Deny/Allow old syntax.
Possible cause: Apache 2.4 migration.
Meaning: The protected file is successfully blocked.
Possible cause: Require/FilesMatch matched.
No records matching this expression were found.
for p in .env .git/config backup.zip database.sql error.log; do curl -sS -o /dev/null -w "$p %{http_code}\n" "https://example.com/$p"; doneChecks the HTTP status of common sensitive files.
curl -sL https://example.com/uploads/ | head -n 30Shows whether a directory listing is displayed for a directory without an index file.
find uploads -type f \( -iname '*.php' -o -iname '*.phtml' -o -iname '*.phar' -o -iname '*.php*' \) -printLists executable PHP-like files in the upload directory.
grep -RniE 'Require|FilesMatch|Files>|Options -Indexes|Order|Deny|Allow' . --include='.htaccess' | head -n 120Finds all subdirectory access rules.
curl -sSI https://example.com/ip-test | grep -iE '^server:|^cf-connecting-ip:|^x-forwarded-for:|^x-real-ip:'Checks proxy/CDN markers; the origin application needs to be logged separately.
tail -n 100 /var/log/apache2/access.log 2>/dev/null || tail -n 100 /usr/local/apache/domlogs/example.com 2>/dev/null || tail -n 100 /var/log/httpd/access_log403 and client IP records are displayed.
<FilesMatch ".*">
Require all denied
</FilesMatch><FilesMatch "(?i)^(?:\.env|\.git|.*\.(?:sql|log|bak|ini|zip))$">
Require all denied
</FilesMatch>Require all denied<FilesMatch "(?i)\.(?:php[0-9]?|phtml|phar)$">
Require all denied
</FilesMatch>Require ip %{HTTP:X-Forwarded-For}<RequireAny>
Require ip 203.0.113.10
Require ip 198.51.100.0/24
</RequireAny>IndexIgnore *Options -IndexesFilesMatch, Require, and Options directives work with the appropriate AllowOverride class.
IP rules may see the proxy IP instead of the real client IP.
Config, log, backup, and upload directories should be protected without disrupting application access
No. NGINX does not read `.htaccess` files. The rule must be translated to a `server` or `location` configuration.
Usually not; Apache evaluates the `.htaccess` file on each request. However, a reload or restart is required for VirtualHost, module, or AllowOverride changes.
A dated backup of the existing file should be taken, the active document root verified, and the change tested on staging or during low-traffic periods.
In cPanel it is usually inside `public_html`, in Plesk inside `httpdocs`; addon domains and subdomains may have a different document root.
LiteSpeed supports most rules through Apache compatibility; some module and handler behaviors may differ.
Full directive and line record in Apache/LiteSpeed error log. The file should be restored according to the log instead of being deleted randomly.
Domain should not be added directly without verifying domain, document root, proxy, WordPress, and server structure. Examples should be adapted and tested.
We examine redirection, rewrite, CORS, access and 500 errors with logs in cPanel, Plesk, LiteSpeed, WordPress, custom PHP and WISECP structures.