To configure caching, go to "Files → File Manager "

    file

    Let's go to the "public_html " folder.

    file

    By default, the ".htaccess " file is hidden. So let's click on "Settings " and check "Show hidden files (dotfiles) ".

    file

    Next, select our .htaccess and click "Edit "

    file

    In the window that appears, click "Disable encoding check " and the "Edit " button.

    file

    You can speed up the loading of the site by using caching. You can use the headers module of the Apache web server to accomplish this task. It allows you to control and modify headers of HTTP requests and HTTP responses. The whole point in this case comes down to making the browser load the rarely changed data from the server into the local cache only once, and then, when you visit the site, use the data from the cache. You can set the caching for certain types of files for a strictly defined time, after which the files will be downloaded from the server again.

    <FilesMatch ".(flv|gif|jpg|jpeg|png|ico|swf|js|css|pdf)$">  
    Header set Cache-Control "max-age=2592000"  
    </FilesMatch>  
    

    For files with these extensions in the FilesMatch construct you will set the Cache-Control header given by the server and the max-age variable, in which the time of storing files in the cache in seconds is specified. Add or remove the file extensions that are relevant for you in this case.

    If you don't need to cache some files, just don't include them in the list. You can also forcibly disable caching of files, most commonly disable caching for dynamic files, such as various scripts. Add the following code to your .htaccess file to disable caching for scripts, making relevant changes for your case beforehand:

    <FilesMatch ".(pl|php|cgi|spl|scgi|fcgi)$">  
    Header unset Cache-Control  
    </FilesMatch>  
    

    As you can see, there are file extensions that do not need to be cached, just specify the desired file types.

    Another way to control caching is to use the expires module. This module controls the installation of HTTP headers for caching data on the browser side. The duration of data storage in the cache can be set by time, by the last file modification or by client access time.

    Below is a simple example of how to use the expires module in a .htaccess file:

    <IfModule mod_expires.c>  
    ExpiresActive On  
    ExpiresDefault "access plus 1 month"  
    
    ExpiresByType image/gif "access plus 2 months"  
    ExpiresByType image/jpeg "access plus 2 months"  
    </IfModule>  
    

    In this example, we turn on the plugin, set the default cache for 1 month, and then set the cache retention time for gif and jpg files to plus 2 months. You can specify times in years, months, weeks, days, hours, minutes, seconds. You can also use the variant of the form:

    ExpiresByType text/html "access plus 1 month 15 days 2 hours"  
    ExpiresByType image/gif "modification plus 5 hours 3 minutes  
    

    You can specify different MIME types as file types, here are some of them as an example:

    image/x-icon  
    image/jpeg  
    image/png  
    image/gif  
    application/x-shockwave-flash  
    text/css  
    text/javascript  
    application/javascript  
    application/x-javascript  
    text/html  
    application/xhtml+xml