How to Fix REST API Errors in WordPress on cPanel
Posted about 4 months ago 4.4kCommon REST API Errors
Errors: 'rest_no_route', 'rest_forbidden', 403/401 on /wp-json/.
Check Permalinks
WordPress → Settings → Permalinks → Save Changes (flush rewrite rules).
ModSecurity Blocking
Common with JSON requests – check ModSecurity hits for wp-json.
Specific Fixes
Disable Conflicting Security Plugins
Test by temporarily disabling Wordfence, iThemes, etc.
Allow API in .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.php$ - [L]
RewriteRule ^wp-json/(.*) /index.php?rest_route=/$1 [QSA,L]
</IfModule>
Common Issues Table
| Error | Cause | Fix |
|---|---|---|
| rest_no_route | Bad URL | Check endpoint |
| rest_forbidden | Authentication | Use nonce or app password |
| 403 on wp-json | ModSecurity | Whitelist rule |
| 500 error | PHP issue | Increase memory |