.htaccess
Quick Definition
.htaccess is a configuration file for Apache web servers that WordPress uses to handle pretty permalinks, redirects, and security rules. It sits in your WordPress root directory.
What Is .htaccess?
.htaccess (short for "hypertext access") is a distributed configuration file for the Apache web server. WordPress uses it to enable pretty permalinks via mod_rewrite.
Default WordPress .htaccess:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
.htaccess in Practice
Hidden file in WordPress root. Auto-generated when you set permalinks. Custom uses: redirects, security rules, GZIP compression, browser caching.
Apache-only — Nginx doesn't use .htaccess. A typo causes 500 errors. Always backup before editing.
Why It Matters
Controls your URLs, security, and server behavior. See our speed guide and security guide.