Tutorials Technical

Google PageSpeed ​​module configuration

This article will present the method for selectively enabling or disabling PageSpeed ​​filters, related to the additional SEO hosting option.

Views 1370Updated now 2 yearsPublished 17/09/2020by Mihai Bobriuc

Introduction

  • If activating the additional SEO option and by default the Google PageSpeed ​​module will create unwanted differences within the site, either visually or in terms of functionality, the various components of the module can be selectively deactivated by editing the .htaccess file. .

Requirements

  • Control panel access data (Plesk or cPanel) for editing the .htaccess file through File Manager.

Steps

  • To check if the PageSpeed ​​module is responsible for the problem encountered, you can disable the entire module by adding the following line to the .htaccess file in the site's root directory:


ModPagespeed off

  • After this step, if the site loads correctly, then the lines added above will be deleted and the specific item responsible for the wrong display will be identified.
  • A first step would be to check the errors received when loading the page by accessing it with Developer Mode in the browser, the general shortcut for activation being F12 key for the usual browsers. For example, a loading error for JS or CSS will indicate a possible conflict with PageSpeed ​​filters, which interact with these elements.

To disable a specific filter, the following rule will be added to the .htaccess file:


ModPagespeedDisableFilters name_filter

Where name_filter will be replaced with the desired identifier.

  • Alternatively, the operation mode of PageSpeed ​​can be changed, so that you can selectively activate each desired element by setting:


ModPagespeedRewriteLevel PassThrough

And then, the desired elements will be specified for activation, as follows:

ModPagespeedEnableFilters name_filter

Also, the name_filter will be replaced with the desired identifier.

  • You can also create a .htaccess file with these rules, in a subdirectory, which contains stylizations (CSS, Javascript, HTML). In this way, the preferential rules will apply strictly to that subdirectory
  • The default active elements when activating the additional SEO option are:
    *These are also the identifiers that you can use in the .htaccess rules.
    • add_head
      Adds a type element to the document if it does not already exist.
    • combine_css
      Combines multiple CSS elements into one.
    • combine_javascript
      Combines multiple JavaScrip elements into one.
    • remove_comments
      Delete comments from processed HTML files. But no inline CSS or JavaScript comments.
    • sprite_images
      Combine CSS wallpapers into a single Sprite.
    • collapse_whitespace
      Delete the empty spaces in HTML files, and ignores the tags: "pre, script, style, textarea"
    • lazyload_images
      Upload images only when they become visible within the page.
    • convert_meta_tags
      Adds a "response header" for each "meta" tag with an attribute "HTTP-equiv".
    • extend_cache
      Extends cache time for images, CSS elements, and scripts that have not been optimized by signing URL with a content hash.
      The following filters are active by default if extend cache is turned on:
      extend_cache_css
      extend_cache_images
      extend_cache_scripts
      For a higher level of control, the filters mentioned above can be activated individually
    • fallback_rewrite_css_urls
      Rewrites URLs for resources that could not be minimized or processed from CSS files.
    • flatten_css_imports
      Recursively replace each @import, rule with the contents of the imported CSS file to reduce the number of external requests.
    • inline_css
      Add small external CSS resources to the HTML document in inline form.
    • inline_import_to_link
      Transform "style" tags that contain only CSS @import to equivalent "link" tags
    • inline_javascript
      Rewrites small JS resources as inlines in the HTML document.
    • rewrite_css
      Rewrite CSS files to remove comments and excess free space.
    • rewrite_images
      Optimize images by editing and removing extra pixels.
      Also, add small images as inline to the document.
    • rewrite_javascript
      Rewrites JavaScript files, removes excess free space and comments.
    • rewrite_style_attributes_with_url
      Rewrite CSS from Style attributes if it contains the text "URL" using the configured rewrite_css filter.

Similar Articles

1
by Mihai Bobriuc
Views 2162
Updated now 2 years
Published 21/07/2017
Creating a website in 3 simple stepsTutorials /General

In this article we explain every step required to have an online site in just a few minutes

by Mark Dohi
Views 2615
Updated now 2 years
Published 07/10/2020
How to install an SSL certificate in Wordpress Tutorials /Applications

This article will describe the steps required to implement the SSL certificate in Wordpress

by Ana Rednic
Views 1799
Updated now 2 years
Published 25/10/2018
Add a domain to Google Postmaster ToolsTutorials /Technical

This article explains how to register a domain in Google Postmaster Tools

by Mihai Bobriuc
Views 1355
Updated now 2 years
Published 05/07/2022
Two Factor Authentication în cPanelTutorials /cPanel

In this tutorial we are going to show you how to configure Two Factor Authentication in the cPanel admin panel

by Mihai Bobriuc
Views 1313
Updated now 2 years
Published 15/07/2022