
WordPress 500 Error After Editing .htaccess
Recover from a WordPress 500 error by restoring the last known-good .htaccess file and using the server log to identify the failed directive.
.htaccess is a plain text file in your site’s root that the web server reads on every single request. It is the reason permalinks work, and it is the fastest way to break a site completely — a stray character produces a 500 error on every page at once, dashboard included.
That combination is why these guides begin with orientation rather than rules. What the file is, what the block WordPress manages inside it does, how the server reads it, and how to take a copy you can put back before you change anything.
From there, the rules worth having. Forcing https, choosing between www and non-www, adding cache headers for static files, and the security headers that tell browsers how strictly to treat your pages.
Another group hardens specific things: stopping directory listings from exposing folder contents, keeping wp-config.php out of reach, blocking XML-RPC if you do not use it, and preventing other sites from embedding your images and billing you for the bandwidth.
The rest is recovery, because everyone breaks this file eventually. A 500 error after an edit, permalinks returning 404 when the WordPress block goes missing, a file the server will not let you write to.
Start with the beginner’s guide to the file even if you have edited it before. It covers the rollback habit that makes everything else here safe to try.

Recover from a WordPress 500 error by restoring the last known-good .htaccess file and using the server log to identify the failed directive.

Find why WordPress cannot write .htaccess and restore only the access required by the hosting or deployment model.

Rebuild the WordPress permalink block without deleting custom hosting, security or redirect directives from .htaccess.

Understand what the WordPress .htaccess file does on Apache, where its rules apply and how to edit it without losing custom configuration.