Troubleshooting

Troubleshoot .htaccess problems: 500 errors, loops and ignored rules

Find and fix broken .htaccess files on cPanel and LiteSpeed hosting: syntax 500 errors, redirect loops, rules that do nothing and conflicts between plugins.

IntermediatecPanel hosting2 min read

One wrong character in .htaccess can take a whole site down with a 500 error, and a badly ordered rule can send visitors round in circles. This guide shows a safe way to isolate the faulty line and fix the most common problems on cPanel hosting with LiteSpeed.

Before you start

  • Access to cPanel → Files → File Manager, with Settings → Show Hidden Files (dotfiles) turned on.
  • Download a copy of the current .htaccess before changing anything.

Confirm .htaccess is the cause

  1. Rename public_html/.htaccess to .htaccess.bak.
  2. Reload the site. If it works (even with broken links), the problem is in that file.
  3. Check cPanel → Metrics → Errors; lines such as Invalid command or RewriteRule: bad flag point at the exact directive.

Find the faulty line

  1. Create a new, empty .htaccess.
  2. Paste the old content back one block at a time (for example the WordPress block, then the caching block, then custom redirects), reloading after each.
  3. When the site breaks, the last block you added contains the error.

Fix common errors

SymptomCauseFix
500 error, Invalid command 'php_value'PHP runs as LSAPI/FPM, not mod_phpRemove php_value lines; set values in MultiPHP INI Editor
500 error after pasting a snippetCurly quotes or a module that isn't loadedRetype quotes; wrap in <IfModule>
ERR_TOO_MANY_REDIRECTSHTTPS or www rule fighting another rule, a plugin or CloudflareKeep one redirect source; see redirect loop fix
Rule does nothingWrong order, missing RewriteEngine On, or [L] rule earlier matches firstPut specific redirects above the WordPress block
Change not visibleBrowser or LiteSpeed cacheTest in a private window; purge cache
403 on the whole siteRequire all denied or a bad IP ruleRemove or correct the deny rule

A clean WordPress .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Plugins such as LiteSpeed Cache add their own blocks above this; leave those markers intact so the plugin can update them. See LiteSpeed .htaccess compatibility.

Tip: Subfolders can have their own .htaccess that overrides the main one. If one section of the site misbehaves, check that folder too.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.