Fix .htaccess 500 Error: Quick Steps That Work
A broken .htaccess file can crash your site with a 500 error. Rename it to disable it, then fix line by line. I've seen this a hundred times.
Quick answer
Rename your .htaccess file to something like .htaccess_old using FTP or cPanel File Manager. If your site works again, the .htaccess was the problem. Now fix it line by line.
Why does this happen?
The .htaccess file tells Apache web server what to do with your pages. When there's a typo, a wrong rule, or a missing module, Apache throws a 500 Internal Server Error. I debugged this for years on shared hosting and VPS setups. Most of the time, the error comes from a bad redirect rule, a rewrite rule that loops, or a syntax mistake. On WordPress sites, a plugin or theme update can add a broken rule. On custom apps, a missing RewriteBase or wrong RewriteCond does it.
Here's a real-world scenario: You update your WordPress site, and boom – every page shows a 500 error. The .htaccess file wrote a rule that doesn't work with your PHP version. Or you added a redirect from HTTP to HTTPS and forgot the RewriteEngine On line.
Step-by-step fix
- Connect to your server using FTP (like FileZilla) or cPanel File Manager. Go to your site's root folder – usually
public_htmlorwww. - Rename .htaccess to .htaccess_old. Right-click, rename, and type the new name. This turns off all custom rules. Refresh your website. If you see your site again – even without pretty URLs – the .htaccess was the problem.
- Create a fresh .htaccess. Start with a minimal one:
# 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 - Test each rule. Add your custom rules one by one. After each addition, refresh your site. If you get a 500 again, the rule you just added is the culprit.
- Check for missing modules. Some rules need Apache modules like
mod_rewriteormod_headers. Runapachectl -Mon your server (if you have SSH) to see what's enabled. On shared hosting, check with your host.
Alternative fixes if renaming works but you need the rules
- Use Fiddler or browser dev tools. Open Network tab, refresh the error page, and look for the 500 status. Sometimes the error text appears in the response body.
- Check Apache error logs. In cPanel, look for "Error Log" under "Logs". The log often says exactly which line failed. For example:
[rewrite:error] ... /home/user/public_html/.htaccess: Invalid command 'RewriteRule', perhaps misspelled. That tells you the line with the rewrite rule. - Disable plugins or themes (WordPress). Rename the
wp-content/pluginsfolder toplugins_old. If the error goes away, one plugin broke the .htaccess. Rename it back and disable plugins one by one from the database or by using a safe plugin like Health Check & Troubleshooting.
Prevention tips to avoid this again
- Always keep a backup of your working .htaccess before editing. Copy it to a file named
.htaccess_backup. - Test changes on a staging site first. Most hosting companies offer a staging environment. Use it.
- Use a syntax checker online. I use htaccess.madewithlove.com – paste your file, it shows errors before you upload.
- Avoid complex rewrites if you don't understand them. Stick to simple redirects unless you test thoroughly.
That's it. This fix works for 95% of .htaccess-related 500 errors. If your site still shows a 500 after renaming the file, the problem is not .htaccess – check PHP errors, file permissions, or memory limit.
Was this solution helpful?