Permalink repair guide
The default WordPress .htaccess file, explained.
Broken post URLs, unexpected 404s, or a missing rewrite block usually point here. Restore the current WordPress rules without overwriting the configuration that is actually yours.
Core writes the lines between # BEGIN WordPress and # END WordPress.
For a normal site, that is the directory containing wp-config.php, not the theme or uploads folder.
Keep host, cache, HTTPS, or security directives outside WordPress’s managed markers.
What the default block does
On Apache, a pretty permalink such as /about/ is not a physical file. The standard WordPress rewrite block lets real files and directories continue normally, then sends the remaining requests to index.php. WordPress reads the requested path and chooses the post, page, archive, or 404 response.
That is why the rules are relevant when the home page works but posts return 404 errors after a migration, a file restore, or a permalink change. They do not apply to Nginx, and they cannot make rewrites work when Apache’s mod_rewrite module or the relevant AllowOverride setting is unavailable.
Use the rules for your installation, not a random snippet
A single WordPress site installed at the web root uses a different destination from a site installed in a subdirectory such as /blog/. The generator produces the standard block for either case, so you do not need to edit regular expressions by hand.
wp-config.php.The rewrite base is normally /./blog/.A safe way to restore it
- 01Confirm that Apache serves the site.
If the host uses Nginx, LiteSpeed, or a managed proxy, ask where rewrite rules live before creating a file that the server will ignore.
- 02Save the existing file first.
Download or copy the current
.htaccess. It may contain directives from the host, cache plugin, or a security product that should not disappear. - 03Generate only the WordPress block you need.
Choose “single site” and the correct installation base in the local .htaccess generator.
- 04Replace the managed markers, not the whole file.
Update the section between WordPress’s BEGIN and END comments, leaving custom directives outside that section intact.
- 05Test a post, a page, and the admin.
Open an ordinary permalink, a static media file, and
/wp-admin/. If only permalinks fail, resave Settings → Permalinks after verifying the file is writable.
Quick answers
What is the default WordPress .htaccess file?
It is the Apache rewrite block WordPress uses to route pretty permalink requests through index.php while allowing real files and directories to pass through unchanged.
Should I delete my entire .htaccess file and start again?
No. Back it up first, then replace only the WordPress-managed section unless you have verified that the other directives are obsolete. Hosts and plugins often add rules outside the WordPress markers.
Why does my site still show 404s after restoring the rules?
The server may not permit .htaccess overrides, mod_rewrite may be unavailable, the site may use Nginx, or the WordPress installation base may be wrong. Check those before adding more rules.
Primary reference: WordPress server configuration documentation.