Caching improves website performance by storing files in a visitor’s browser. However, during development or troubleshooting, you may want to disable caching so changes are reflected immediately. On ruachost.com, you can control caching behavior using the .htaccess file.

 

Why Turn Off Caching?

  • Ensure visitors see the latest version of your site.

  • Prevent browsers from serving outdated files.

  • Useful when testing new designs, scripts, or content.

 

Steps to Disable Caching

Step 1: Edit the .htaccess File

  1. Log in to your hosting account via FTP, SFTP, or File Manager.

  2. Navigate to your site’s root directory (public_html).

  3. Open or create the .htaccess file.

 

Step 2: Add Cache‑Control Directives

Insert the following code at the bottom of the .htaccess file:

 
# DISABLE CACHING
<IfModule mod_headers.c>
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0
</IfModule>

<FilesMatch "\.(css|flv|gif|htm|html|ico|jpe|jpeg|jpg|js|mp3|mp4|png|pdf|swf|txt)$">
    <IfModule mod_expires.c>
        ExpiresActive Off
    </IfModule>
    <IfModule mod_headers.c>
        FileETag None
        Header unset ETag
        Header unset Pragma
        Header unset Cache-Control
        Header unset Last-Modified
        Header set Pragma "no-cache"
        Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
        Header set Expires "Thu, 1 Jan 1970 00:00:00 GMT"
    </IfModule>
</FilesMatch>

Step 3: Save and Test

  • Save the .htaccess file.

  • Clear your browser cache.

  • Reload your site to confirm changes are applied.

Important Notes

  • Place new rules at the bottom of the .htaccess file so they override earlier caching instructions.

  • Remove or comment out these lines when you want caching enabled again.

  • Disabling caching may slow down site performance for visitors.

Bu cavab sizə kömək etdi? 0 istifadəçi bunu faydalı hesab edir (0 səs)

Powered by WHMCompleteSolution