.htaccess

Default .htaccess Configuration for WordPress Sites

7/25/2025
5 min read

Default WordPress .htaccess rules used for handling pretty permalinks and request routing.
If your WordPress site is showing HTTP 404 errors on posts or pages, this code is essential to restore proper URL rewriting.
Place it in the .htaccess file located in the root WordPress directory (usually public_html).


# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress