# Turning off caching using .htaccess

> Stop browsers caching your site during development by adding Cache-Control directives to your .htaccess file.

Source: https://helpcenter.ruachost.com/developers/web-servers/turning-off-caching-using-htaccess/

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

    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
    Header set Expires 0

    
        ExpiresActive Off
    
    
        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"
    

```

### 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.
