Fix HTTP Error 500, 403, 404 on Web Hosting — Causes and Solutions

A blank white page showing 500, 403, or 404 means something has gone wrong. Each error code has a different meaning and a different fix. This guide breaks down the most common HTTP errors on shared web hosting, explains the causes, and shows you how to read the error log in DirectAdmin to find the real root cause.

1. What Are HTTP Error Codes?

HTTP status codes are response codes the web server sends to the browser. Codes starting with 4xx indicate a client-side error; 5xx codes indicate a server-side problem.

2. Error 500 — Internal Server Error

Error 500 is the most common and least descriptive error. The server knows something went wrong but does not show you what. You must check the error log to find the real cause.

Common Causes

Fix a Broken .htaccess

Rename .htaccess to .htaccess.bak and reload the page. If the error disappears, .htaccess was the culprit. Re-enable it line by line to find the bad directive.

Fix PHP Memory and Timeout

Add these lines to your .htaccess file:

php_value memory_limit 256M
php_value max_execution_time 300
php_value post_max_size 64M
php_value upload_max_filesize 64M

WordPress: Add define('WP_MEMORY_LIMIT', '256M'); to wp-config.php to raise the memory limit specifically for WordPress.

3. Error 403 — Forbidden

Error 403 means the server knows what you are requesting but will not let you access it. Common reasons:

Fix File Permissions

In DirectAdmin → File Manager → select file → Change Permissions, or via SSH:

# Files should be 644
chmod 644 filename.php

# Directories should be 755
chmod 755 /public_html/dirname

# Recursive fix for all files and directories
find /public_html -type f -exec chmod 644 {} \;
find /public_html -type d -exec chmod 755 {} \;

4. Error 404 — Not Found

Error 404 means the server cannot find the requested resource. Common causes:

WordPress: Flush Permalinks

Go to Settings → Permalinks → click "Save Changes" without changing anything. This regenerates the .htaccess rewrite rules WordPress needs for clean URLs.

Add Custom Error Pages

Add these lines to .htaccess to redirect error codes to friendly pages:

ErrorDocument 404 /404.html
ErrorDocument 403 /403.html
ErrorDocument 500 /500.html

5. How to Check Error Logs in DirectAdmin

The error log is the most powerful debugging tool available on shared hosting. It shows the actual error messages generated by PHP and Apache.

Opening the Error Log

  1. Log in to DirectAdmin.
  2. Go to Advanced Features → Site Summary / Statistics / Logs.
  3. Click Error Log or the file named error_log.

Examples of error log entries:

[Mon May 12 10:23:45 2026] [error] PHP Fatal error:
  Allowed memory size of 134217728 bytes exhausted
  in /home/user/domains/example.com/public_html/wp-load.php on line 456

[Mon May 12 11:05:12 2026] [error] PHP Parse error:
  syntax error, unexpected '}' in
  /home/user/domains/example.com/public_html/functions.php on line 89

6. Error 502 and 508 — Bad Gateway and Resource Limits

Beyond 500, 403, and 404, two more error codes appear frequently on shared hosting — especially when a site receives sudden traffic spikes or runs heavy scripts.

502 Bad Gateway

Error 502 means a gateway or proxy server received an invalid response from an upstream server. On shared hosting the most common causes are:

A 502 often resolves on its own within 30–60 seconds. If it keeps occurring, check the error log and consider optimising your heaviest PHP scripts or contacting support to review server health.

508 Resource Limit Reached

Error 508 is used by DirectAdmin (and some cPanel/LiteSpeed environments) to signal that your account has exceeded its CPU, RAM, or I/O quota assigned to your hosting plan.

7. Preventing Errors Before They Happen — Best Practices

Fixing errors quickly matters, but preventing them from occurring in the first place matters more. The following practices significantly reduce the frequency of HTTP errors on shared hosting.

Log Errors Instead of Displaying Them

Never display PHP errors on a production site — it leaks internal paths and logic to visitors. Write errors to a log file instead:

# Add to .htaccess
php_flag display_errors off
php_flag log_errors on
php_value error_log /home/USER/error_php.log

Validate .htaccess Before Uploading

Syntax errors in .htaccess are the leading cause of Error 500 on shared hosting. Test the file before deploying:

# On Linux/Mac with Apache installed
apachectl -t

# Or use an online validator:
# https://htaccess.madewithlove.com/

Fix Permissions Right After Uploading Files

Files uploaded via FTP often land with incorrect permissions. Check and correct them immediately after upload:

# Find files with dangerous permissions
find /public_html -type f -perm 777
find /public_html -type f -perm 000

# Bulk fix all files and directories
find /public_html -type f -exec chmod 644 {} \;
find /public_html -type d -exec chmod 755 {} \;

Create Custom Error Pages for Better UX

When an error does occur, users should see a helpful page rather than a blank screen. Custom error pages can guide visitors back to working content:

ErrorDocument 400 /errors/400.html
ErrorDocument 403 /errors/403.html
ErrorDocument 404 /errors/404.html
ErrorDocument 500 /errors/500.html

WordPress tip: Use a plugin such as "404page" or "Custom 404 Pro" to set a branded error page without editing files manually.

8. Debugging Tools Inside DirectAdmin

DirectAdmin includes several built-in tools that let you investigate errors without SSH access. Knowing where to look saves significant troubleshooting time.

Tool Location in DirectAdmin Best For
Error LogAdvanced → Site Summary / LogsError 500, PHP Fatal, Parse errors
Access LogAdvanced → Site Summary / LogsSee which URLs are erroring and from which IPs
Resource UsageAccount Manager → Resource UsageError 508, CPU and RAM spikes
File ManagerAdvanced → File ManagerFix permissions, edit .htaccess directly
PHP SettingsAdvanced → PHP ConfigChange memory limit, execution timeout

Reading the Error Log Efficiently

Error logs can grow large quickly. Use these commands to filter only the entries you need:

# Show only PHP Fatal errors
grep -i "Fatal error" error_log | tail -20

# Show errors from the last hour
grep "$(date +'%b %d %H')" error_log | grep -i error | tail -50

# Find files generating the most errors
grep -i "error" error_log | grep -oP 'in /[^ ]+' | sort | uniq -c | sort -rn | head -10

9. Error Summary Table

CodeNameCommon CauseQuick Fix
500Internal Server ErrorBad .htaccess / PHP error / memory exceededRename .htaccess / check error log
403ForbiddenWrong permissions / no index filechmod 755/644 / create index.html
404Not FoundFile deleted / wrong permalinkFlush permalink / check URL
502Bad GatewayPHP-FPM crash / server overloadContact support
508Resource LimitCPU/RAM quota exceededOptimize code / upgrade plan

Stable Hosting with 99% Uptime and 24/7 Support

AsiaGB Hosting starts at 500 THB/year with DirectAdmin, error logs, PHP 7.4/8.2/8.3, and SSD storage. Our support team can help you diagnose and fix any hosting error.

View Hosting Plans