Look up Apache httpd directives without the manual
Apache HTTP Server is configured by directives, and each one has rules about
where it may appear and whether a .htaccess file can use it. This reference
lets you search directives by name, module or description and filter by status,
showing the valid context, the AllowOverride class, the syntax and the
providing module. It runs entirely in your browser.
How it works
Each entry lists the directive, its module (e.g. mod_rewrite), the status
flag, the syntax, the contexts it is valid in, and the AllowOverride class
that lets it appear in .htaccess. Apache processes directives from the main
config down through <VirtualHost>, <Directory> and .htaccess files. A
directive only works inside .htaccess if its override class is enabled for
that directory. A typical rewrite to force HTTPS looks like:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Validate changes with apachectl configtest and apply them with
apachectl graceful.
Tips and examples
- To allow
.htaccessoverrides for a directory, setAllowOverride FileInfo(for rewrites/headers) orAllowOverride Allin the matching<Directory>block; the defaultNoneignores.htaccessentirely. - Restrict access with
Require ip 192.168.1.0/24or open it withRequire all granted— these are the 2.4 replacements forAllow/Deny. - Use
Header always set Strict-Transport-Security "max-age=31536000"to send HSTS even on error responses. ProxyPass "/api" "http://127.0.0.1:3000/"turns Apache into a reverse proxy whenmod_proxyandmod_proxy_httpare loaded.