A 508 Loop Detected on cPanel is one of the rarer error codes, and when it appears, the cause is almost always self-inflicted: an .htaccess rule that redirects to a URL that itself redirects back, or a vhost include that mounts the same alias twice. The browser eventually gives up (modern browsers cut off around 20 redirects), and the server, if mod_dir or mod_rewrite detects the loop, returns 508.
What’s happening
Two patterns cause this. The first is .htaccess that forces HTTPS and HTTPS that forces back to a path without HTTPS (often after a migration where one rule was copied but the other was not). The second is a Rewrite rule that adds a trailing slash and a separate rule that removes it; the request bounces forever. Apache’s mod_rewrite has loop protection that fires after 10 iterations, and LiteSpeed has similar.
How to verify
Find the loop in the user’s .htaccess and vhost:
# the user's .htaccess
cat /home/<user>/public_html/.htaccess
# any nested .htaccess in subdirectories
find /home/<user>/public_html -name .htaccess
# vhost include
cat /etc/apache2/conf.d/userdata/std/2_4/<user>/<domain>/*.conf
# Apache error log for the loop signature
tail -200 /usr/local/apache/logs/error_log | grep -i "loop\|redirect"
# trace the loop from outside
curl -ILk https://example.com 2>&1 | head -30
The last command shows the redirect chain. If you see https://example.com -> https://example.com/path -> https://example.com -> ..., the loop is right there.
The fix
- Identify the conflicting rules —
.htaccessusually contains a “force HTTPS” block at the top and an application-specific rewrite (WordPress, Laravel) below. The two together can loop if HTTPS detection is misconfigured. - HTTPS detection behind a proxy — if Cloudflare or a load balancer terminates TLS, Apache sees HTTP. A rule that says “if not HTTPS, redirect to HTTPS” then loops. Use
RewriteCond %{HTTP:X-Forwarded-Proto} !httpsinstead of%{HTTPS} off. - Trailing slash conflict — pick one. Either always trailing slash or never. Pick one rule, delete the opposite, test with
curl -IL. - Application-level redirect plus server-level redirect — WordPress’s
siteurlandhomeare doing the same job as a server redirect. If they disagree (siteurl=https,home=http), the application loops. Fix at the application level. - Test before deploying — use
apachectl -t -D DUMP_VHOSTSto confirm the vhost is sane after edits.apachectl gracefulto apply.
A 508 that started after a migration where TLS terminated on a different layer is the most common pattern. Stack Harbor handles redirect-loop diagnosis under cPanel/WHM management — start a conversation when loops appear post-migration.