Nowadays all want to build a website/blog for their business and get success to bring their business online but get failed to populate their business over the globe. To get success in your digital business you must have to go with the digital marketing strategy and digital marketing itself depends on your site weight means the site must be light-weighted, smooth and load within a second. To do the same first you have to try to optimize the site with some custom technique.
Step 1: Test your site on Google PageSpeed Insights to view your current score on both Desktop and Mobile devices.
Step 2: Go to the root directory of the site and open up your .htaccess file with the help of FTP or any other tools. Here, we want to enable browser caching. Copy and paste the below-given codes on your .htaccess file. Once you save the changes to your file, go back to your website and check everything is working fine or not.
# BEGIN Expire headers
ExpiresDefault “access plus 5 seconds”
ExpiresByType image/x-icon “access plus 2592000 seconds”
ExpiresByType image/jpeg “access plus 2592000 seconds”
ExpiresByType image/png “access plus 2592000 seconds”
ExpiresByType image/gif “access plus 2592000 seconds”
ExpiresByType application/x-shockwave-flash “access plus 2592000 seconds”
ExpiresByType text/css “access plus 604800 seconds”
ExpiresByType text/html “access plus 600 seconds”
ExpiresByType application/xhtml+xml “access plus 600 seconds”
# END Expire headers
# BEGIN Cache-Control Headers
Header set Cache-Control “public”
Header set Cache-Control “public”
Header set Cache-Control “private”
Header set Cache-Control “private, must-revalidate”
# END Cache-Control Headers
Step: 3. As you know the WordPress offers post revisions by default. Everytime you make any changes on your WordPress website, it stores every changes on your database. I think it is not required for you. If it is not required to you then you can simply disable these features as it takes to many spaces in our database and makes the database and site performance slow.
To disabled wp post revision, go to the root directory of your website. Locate your wp-config.php file and open it. You just need to copy the given bellow codes on your wp-config.php file.
define( ‘WP_POST_REVISIONS’, false);
If ‘wp post revision’ important for you then you can simply make this features and set it to save limited number of revisions only by using the given bellow codes.
define( ‘WP_POST_REVISIONS’, 5);
Here, WordPress will store maximum 5 numbers of revisions of your each post/pages.
To check whether gzip is enabled on your website and what the gzip compression rate is, use this popular tool Gift of speed.
After testing your score, if you want to enable the Gzip compression then you can do this by two methods.
A) Open your .htaccess files, copy and paste the given below codes.
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/opentype
# For Olders Browsers Which Can't Handle Compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
B) Open your php.ini file. It locates depending on your host. When you located your php.ini file, just copy and paste the given below codes to enable Gzipping compression.
zlib.output_compression = ON
If you already found the codes like “
zlib.output_compression = Off” in your php.ini files then simply change it with ‘
OFF’ to ‘
Steps 5. Recheck you site speed again on Google PageSpeed Insights
Find More Topics:
Get the client IP address using PHP
How To Auto Redirect Users After Logout In WordPress
How to Display the Post by Category
How to Create Our Own Shortcode in WordPress
How to Fix Internal Server Error on WordPress