So you got the dreaded email of please optimize your site, or your site is loading slow, or why is the page giving 500 errors. There are several things that can cause these errors. Below I'll go over some things you can do to help in lowering those process limits to allow more traffic and less server load to focus on the important things, your customers.
Doing these two things will greatly increase your score in GTMetrix, especially WordPress!
The first and most easiest thing is always the first thing to be read when a site is loading and that is your .htaccess file. In the .htaccess file you will find all things that guide and tell your site to load from how to send the data to the file that will guide it all. Pasting this in the top of your .htaccess will allow the site to reduce server load, send data faster, and place the load on the customer instead of the server.
Secondly, if you are using WordPress to host your site, it is strongly recommended to use W3 Total Cache. It is more effective than WP Rocket and WP Supercache.
Step 1: Go to the .htaccess file and add this to the top of the file:
FileETag none <IfModule mod_expires.c> <IfModule mod_headers.c> ExpiresActive On ExpiresDefault A0 ExpiresDefault "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresByType image/gif "access plus 1 month" ExpiresByType image/png "access plus 1 month" ExpiresByType image/jpg "access plus 1 month" ExpiresByType image/jpeg "access plus 1 month" ExpiresByType text/css "access 1 month" ExpiresByType application/javascript "access plus 1 year" <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$"> ExpiresDefault A29030400 Header append Cache-Control "public" </FilesMatch> <FilesMatch "\.(gif|jpg|jpeg|png|swf)$"> Header append Cache-Control "public" </FilesMatch> <FilesMatch "\.(xml|txt|html|js|css)$"> Header append Cache-Control "proxy-revalidate" </FilesMatch> <FilesMatch "\.(php|cgi|pl|htm)$"> ExpiresActive Off Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform" Header set Pragma "no-cache" </FilesMatch> </IfModule> </IfModule> <IfModule mod_deflate.c> SetOutputFilter DEFLATE BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html SetEnvIfNoCase Request_URI \ \.(?:gif|jpe?g|png)$ no-gzip dont-vary Header append Vary User-Agent env=!dont-vary </IfModule>
Step 2: Setting W3 Total Cache
- Go to your WP-Admin
- Go to Plugins
- Click Add New
- Search W3 Total Cache
- Click Install
- At the top of WP-Admin, you will see Performance
- Click General Settings
- Select Page Cache Enable
- Select Page Cache Method "Disk Enhanced"
- Minify mode "Auto"
- Minify Cache Method "Disk"
- Database Cache "Enable"
- Database Method "Disk"
- Browser Cache: "Enable"
- CDN "Enable"
- CDN Type "Stackpath"
- Enable Lazy Load Images (Click the check box)
- Click Save Settings & Purge Caches