fb-pixel
Logo Supporthost

How to enable mod_pagespeed

December 22, 2021 / Published in:  from Ivan Messina
No comments

Slow web page loading is a very common problem and can sometimes be difficult to deal with. Fortunately though, there are tools like mod_pagespeed that can help you solve it.

What is mod_pagespeed

Mod_pagespeed is an open source add-on developed by Google, for Apache and Nginx web servers, created with the purpose of optimizing the performance of websites and the structure of its resources.

Through some filters present in this module you can automate some operations aimed at improving the resources on your site, reducing latency.

These filters, each with a specific function, will allow you to optimize the HTML, JavaScript and CSS resources on your site, also speeding up the loading of images.

How it improves performance

Having an optimized and fast website brings several benefits, including greater visitor engagement. Mod_pagespeed brings several improvements to your site and, among its many features, allows you to:

  • Compress and convert images into lighter formats.
  • Reduce the size of HTML files, scripts, style sheets.
  • Optimize the loading of resources, giving priority to the most important resources.
  • Optimize the code and structure of the resources on the site, following Google’s guidelines.

How to enable mod_pagespeed from cPanel

By default it is not active on our systems, however you can enable mod_pagespeed by editing the .htaccess file present on your website.

To edit the .htaccess file, first login to cPanel.

From the main cPanel screen, scroll down the page to the “Files” section and select “File Manager“.

Cpanel File Manager

Locate the .htaccess file, right click on the file and select “Edit” from the context menu.

Edit Htaccess

A confirmation message will appear, hit “Edit” again to begin editing the file.

Edit Htaccess File

Enter the following code inside the .htaccess file and save the changes you just made.

<IfModule pagespeed_module>
ModPagespeed on
</IfModule>

If you don’t see the .htaccess file in the File Manager panel, make sure the “Show hidden files” option is enabled in the settings.

Show Hidden Files Option Enabled

Disable mod_pagespeed

If you want to completely disable mod_pagespeed from your site, enter the following code.

<IfModule pagespeed_module>
ModPagespeed off
</IfModule>

Configure mod_pagespeed

Properly configuring mod_pagespeed can greatly improve the performance of your website. The .htaccess file can be configured by enabling or disabling new options within it.

Enabling a mod_pagespeed filter

You can add new instructions by editing the .htaccess file, use this syntax:

ModPagespeedEnableFilters filter1,filter2,filter3

To see the full list of filters, you can consult the official documentation on configuration filters.

Disable a mod_pagespeed filter

If you want to disable one or more filters, the use to follow is:

ModPagespeedDisableFilters filter1,filter2,filter3

Related posts

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.