Google PageSpeed ​​module configuration

Tutorials Technical | pagespeed | google | seo | modpagespeed | htaccess | optimization | apache | pagespeed_module
This article will present the method for selectively enabling or disabling PageSpeed ​​filters, related to the additional SEO hosting option.
by Mihai BobriucViews 710Updated now 1 yearPublished 17/09/2020

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
Adding an MX record to the cPanel admin panel, redirecting your mail server to GoogleTutorials Email | mx | mx records | mx registration | dns | email
How to add MX Records and forward mail to the Google mail server
by Mihai BobriucViews 1487Updated now 1 yearPublished 21/07/2017
Creating a website in 3 simple stepsTutorials General | website | sitebuilder | sitepad
In this article we explain every step required to have an online site in just a few minutes
by Mark DohiViews 1593Updated now 1 yearPublished 07/10/2020
How to install an SSL certificate in Wordpress Tutorials Applications | install | wordpress | ssl | https | secure | http
This article will describe the steps required to implement the SSL certificate in Wordpress
by Ana RednicViews 1158Updated now 1 yearPublished 25/10/2018
Add a domain to Google Postmaster ToolsTutorials Technical | domain | google | postmaster | dns
This article explains how to register a domain in Google Postmaster Tools
by Mihai BobriucViews 833Updated now 1 yearPublished 05/07/2022
Two Factor Authentication în cPanelTutorials cPanel | two factor authentication | two-step authentication | cpanel
In this tutorial we are going to show you how to configure Two Factor Authentication in the cPanel admin panel
by Mihai BobriucViews 746Updated now 1 yearPublished 15/07/2022