Question
What advanced steps can be taken to improve the performance of a WordPress site in cPanel & WHM?
Answer
WordPress is a very flexible platform, and every website unique can be unique. This guide provides some more advanced steps to optimize your WordPress installations.
Note: The following suggestions require a bit more knowledge of the file system of your WordPress installation, as well as the database that it operates on. We recommend contacting a system administrator or WordPress developer for direct assistance with further optimization.
Expires caching
Add the following code to the site's .htaccess file to have resources cached by the user's browser:
CONFIG_TEXT: ## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
Optimize uploaded images for the internet
Large images can significantly slow down a website, and most common image formats are not optimized for static web delivery. Web applications such as WordPress have plugins and features that can help to optimize images uploaded to websites, and most photo editing applications can let you do this via a "Save for Web" option.
Limit crawlers and bots
Bots and automated crawlers can cause resource usage due to the number of requests that they can make. The following provides further information on this.
How to limit Crawlers & Bots from crawling a website
Limit spam comments
WordPress allows for comments on pages and posts, and can be a common place for spammers or malicious actors. For websites where comments are enabled, using a plugin to manage and limit spam comments can help reduce page resources.
Additionally, splitting comments into pages with the Break comments into pages.. option of the site's Discussion settings can help as well.
Limit post revisions
WordPress maintains "snapshots" of posts so you can easily revert changes if necessary. However, these are stored in the website's database, and can increase its size. The number of stored revisions can be limited by adding the following code to your site's wp-config.php file.
CONFIG_TEXT: define( 'WP_POST_REVISIONS', 3 );
Alternatively, revisions can be disabled by adding the following line instead:
CONFIG_TEXT: define( 'WP_POST_REVISIONS', false );
Enable Hotlink protection
Hotlinking is the act of linking an image from a different website, using their domain. This can cause unnecessary resource usage on your own server as clients connect for resources in use on a different domain.
How to enable hotlink protection
Additional resource
Basic WordPress Optimization Steps
Comments
0 comments
Article is closed for comments.