2.17.2.1. Site optimization settings (PageSpeed)
Attention!
- The use of plugins on the site that perform the same actions as PageSpeed filters may lead to errors in the site's operation. We recommend using only one — either plugins or PageSpeed.
- It is not recommended to enable PageSpeed when using OpenLiteSpeed (see the OLS official documentation).
The site optimization settings use Google PageSpeed module filters. It is installed on the hosting by default and is designed to speed up page display in the browser. Documentation is available on the official site.
Description
The speed of a website is one of the most important factors that modern visitors pay attention to. Delays in website display cause irritation, negatively affect search engine rankings, and reduce the revenue of commercial websites. From the visitor's perspective, two main parameters influence the website's speed: the speed of page generation on the server and the speed of page display by the browser. To accelerate page generation on servers, we use modern equipment and fine-tune the software. Our clients also have access to tools that allow them to further accelerate the page display speed in the visitor's browser by simply making changes to their website settings.
Causes of problem
Most of the time when the browser displays a page, it takes to load its additional elements — images, JavaScript and CSS. Almost all design themes of popular CMS use JavaScript frameworks with dozens of plugins and a lot of CSS styles. The total amount of data downloaded by the visitor often exceeds 500 KB, and the number of requests to the server to display one page is several dozens. This negatively affects the speed of page loading for the visitor.
Solution methods
There are several techniques that can be used to improve the speed of the site display in the client's browser:
- Reduce the volume of transmitted data.
- Reduce the number of server requests.
- Configure caching of static files in a browser.
- Optimize page rendering.
You can reduce the number of requests to the server, the amount of data transferred and the efficiency of data compression by merging several files into one and removing unnecessary comments and spaces. If the site has a lot of graphics at the bottom of pages (which are visible only when scrolling), delayed loading of images may be useful. To speed up page rendering, you should set up the correct order of connecting CSS and JavaScript files, and possibly move minor CSS to HTML code. If elements from other sites are actively used on pages (traffic counters, social network widgets, online help chats), pre-rendering DNS names of these resources can increase their loading speed in modern browsers. You can perform this kind of optimizations with PageSpeed settings. All optimizations are performed on-the-fly, without the need to make changes to the site code.
Optimization and HTTPS
The PageSpeed module also works over HTTPS protocol. When a site is redirected from HTTP to HTTPS (or vice versa) using .htaccess, there may be problems with the PageSpeed module processing content over HTTPS. To fix the situation, you need to remove redirect directives from .htaccess and instead enable the required redirect in the site settings (see Setting up redirect to HTTP/HTTPS).
Static caching
Caching allows the browser to save a copy of a static file on the visitor's computer and not request it from the server upon subsequent visits. However, this creates inconveniences for developers, as changes to these files will be visible to visitors with a delay due to caching. To avoid this issue, PageSpeed includes parameters for advanced caching of images, styles, and scripts. When these are used, a hash of the file's content is added to the URL of static files, which changes when the file is edited. This achieves long-term caching while allowing for changes to be made freely.
Configure
Important points:
- There is no universal set of settings suitable for all websites without exception. Options need to be selected individually for each specific site. For some websites, they may not be needed at all if the programmers have implemented the corresponding functionality in the engine, while for others, only part of the parameters may be required.
- Suitable settings for the site can be determined experimentally by enabling them one by one and checking the site's functionality at each stage. Some settings may disrupt the normal operation of the site. For example, after enabling minification or combining JavaScript, interactive elements on the site may stop working (certain buttons may not be clickable). This means that the setting is incompatible with the site. In this case, it should be disabled and the PageSpeed cache should be cleared.
- The effectiveness of settings directly depends on how the developers of the site approached its optimization. For an initially well-optimized site, settings may be unnecessary.
- Some PageSpeed filters may create additional load on the server. By generating optimized files, the module creates numerous requests to the server. Most of these requests are directed at static content, and their processing should not cause server load and issues. However, in some cases, requests may be directed at content generated by PHP scripts, thereby creating a significant load (such a scenario is extremely rare but does occur).
- PageSpeed optimization filters do not modify files on the server, so after disabling them, the site will return to its previous state.
- The PageSpeed module has some nuances of operation. You can read about them in the documentation on official site.
- Some merge modules have a MaxBytes limit value, at which files will not be merged beyond this size. The MaxBytes value is 1 KB on hosting.
- Open the "Site settings" section.
- On the "Site optimization settings" tab, enable or disable the desired options and save your changes:

- Wait 15-30 minutes for the changes to take effect.
Additional attributes with URL value
By default, PageSpeed filters that process URLs take into account attributes from the HTML4 and HTML5 specifications, as well as some common extensions listed in the PageSpeed documentation. If the site uses non-standard attributes for URLs (for example, links to images in <li data-thumb="URL">), you should explicitly tell PageSpeed to process them.
Attributes are added to the field "Additional attributes with URL value" (be sure to save the changes after adding):
Exceptions
Rules for specifying exceptions:
- The URL should be specified without the name of the site itself, such as
*/jquery.jsor*/static*. - Directories should be enclosed with two
*characters, e.g.*/content*. - Each exception is specified on a new line.
- The length of a single exception must not exceed 100 characters.
- Available characters:
a-z 0-9 - . _ / *.
- Open the "Site settings" section.
- On the "Site Optimization Settings" tab, in the "PageSpeed Exceptions" field, enter the URLs that need to be excluded and save the changes:

- Wait 15-30 minutes for the changes to take effect.
Clear cache
Attention!
- To clear the PageSpeed cache, a special request is sent to the site. If an error occurs while clearing the cache, check the server response codes in the access logs for requests with the
pagespeed cache cleaneruser agent. For example, redirect directives from the .htaccess file may interfere with such requests in some cases. In such a situation, the solution may be to temporarily rename this file while the cache is being cleared. - The cache clearing button is displayed only if optimization settings are enabled. If optimization or all its options are disabled, the button will not be displayed.
- Open the "Site settings" section.
- On the "Site Optimization Settings" tab at the bottom of the page, click "Clear Cache":

Disable
- Open the "Site settings" section.
- On the "Site optimization settings" tab, disable all options or enable the "Disable site optimization" option and save your changes:

- Wait 15-30 minutes for the changes to take effect.