Guides › HTML / PHP sites › Site down or error screens

500 Internal Server Error After Editing .htaccess: Find the Bad Line

A mistake in .htaccess makes the server return error 500 for the whole site. Rename the file, confirm that fixes it, then restore rules one block at a time.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.
Site down or error page

If a 500 error started right after you edited .htaccess, the file almost certainly has a line the server cannot understand. You can get the site back in a minute and then find the line.

1Rename the file2Turn on hidden files3Read the error log4Restore a clean file5Add your changes back one at a time6Check common mistakes7Check the file ends correctlyFixed? Test the site. If not, get help.
The steps in order. Work down the list and stop when the problem is solved.

Step 1: Rename the file

Illustration for Step 1: Rename the file

In File Manager or FTP, rename .htaccess to .htaccess-old. Reload the site. If it comes back, the file was the cause.

Step 2: Turn on hidden files

Illustration for Step 2: Turn on hidden files

If you cannot see .htaccess, enable Show Hidden Files in File Manager settings, or in FTP show hidden files.

Step 3: Read the error log

Illustration for Step 3: Read the error log

In your hosting panel open Errors or Logs. A line such as .htaccess: Invalid command or AH00526 names the exact directive and line number.

Step 4: Restore a clean file

Illustration for Step 4: Restore a clean file

For WordPress, go to Settings, Permalinks and click Save to rebuild a default .htaccess. For other sites, restore the last backup copy.

Step 5: Add your changes back one at a time

Illustration for Step 5: Add your changes back one at a time

Paste back one block, save, reload. When the 500 returns, the last block you added is the culprit.

Step 6: Check common mistakes

Illustration for Step 6: Check common mistakes

Typos in directive names, a missing RewriteEngine On, unclosed <IfModule> tags, smart quotes copied from a web page, and directives your host does not allow.

Step 7: Check the file ends correctly

Illustration for Step 7: Check the file ends correctly

Make sure the file is plain text with no extra characters, and that it uses straight quotes.

Still stuck?

If these steps do not solve it, we fix it for you for a flat $99. Full refund if we do not solve it within 7 days.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-22.