1. How to Diagnose Website Errors (500/404/403 Errors)
500 Internal Server Error
What’s happening? The server encountered an unexpected issue (e.g., code errors, plugin conflicts).
How to Fix:
- Check Server Logs
- For Apache: Open terminal and run:
tail -n 20 /var/log/apache2/error.log - For Nginx: Open terminal and run:
tail -n 20 /var/log/nginx/error.log
- For Apache: Open terminal and run:
- Fix PHP Syntax Errors
Example broken code:
Fixed code:
- Increase PHP Memory Limit
Add to
wp-config.php:define('WP_MEMORY_LIMIT', '256M');
404 Not Found Error
What’s happening? The page/resource you’re trying to access doesn’t exist.
How to Fix:
- Redirect Broken Links
Add to
.htaccess:Redirect 301 /old-page /new-page - Create a Custom 404 Page
403 Forbidden Error
What’s happening? Access denied (e.g., incorrect file permissions).
How to Fix:
- Fix File Permissions
chmod 644 filename.php // For files chmod 755 directory/ // For folders - Disable Directory Listing
Add to
.htaccess:Options -Indexes
2. Steps to Debug "White Screen of Death" (WSOD)
How to Fix:
- Enable Debugging
Add to
wp-config.php:define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); - Increase PHP Memory Limit
define('WP_MEMORY_LIMIT', '256M'); - Disable Plugins/Themes
Rename the
pluginsfolder via FTP (e.g.,plugins_deactivated).
3. Resolving Slow Website Performance
Server-Side Fixes
- Enable Caching
ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType text/css "access 1 month"
Client-Side Fixes
- Optimize Images
Use TinyPNG to compress images.
4. Fixing Broken Links
How to Fix:
- Redirect Broken Links
Redirect 301 /broken-link https://example.com/new-link
5. Browser Developer Tools
How to Use:
- Open DevTools
Windows:
F12orCtrl + Shift + I
Mac:Cmd + Option + I - Debug JavaScript Errors
Go to the Console tab to view errors.
Note: Replace placeholder URLs (e.g.,
/old-page) with your actual URLs. Test changes in a staging environment first.