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
.htaccessbefore changing anything.
Confirm .htaccess is the cause
- Rename
public_html/.htaccessto.htaccess.bak. - Reload the site. If it works (even with broken links), the problem is in that file.
- Check cPanel → Metrics → Errors; lines such as
Invalid commandorRewriteRule: bad flagpoint at the exact directive.
Find the faulty line
- Create a new, empty
.htaccess. - 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.
- When the site breaks, the last block you added contains the error.
Fix common errors
| Symptom | Cause | Fix |
|---|---|---|
500 error, Invalid command 'php_value' | PHP runs as LSAPI/FPM, not mod_php | Remove php_value lines; set values in MultiPHP INI Editor |
| 500 error after pasting a snippet | Curly quotes or a module that isn't loaded | Retype quotes; wrap in <IfModule> |
| ERR_TOO_MANY_REDIRECTS | HTTPS or www rule fighting another rule, a plugin or Cloudflare | Keep one redirect source; see redirect loop fix |
| Rule does nothing | Wrong order, missing RewriteEngine On, or [L] rule earlier matches first | Put specific redirects above the WordPress block |
| Change not visible | Browser or LiteSpeed cache | Test in a private window; purge cache |
| 403 on the whole site | Require all denied or a bad IP rule | Remove 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 WordPressPlugins 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.
