# Optimising website performance

> Speed up your website with compression, caching, optimised images and code, and other proven performance techniques.

Source: https://helpcenter.ruachost.com/apps/guides/optimizing-website-performance/

Improving your website’s performance ensures faster load times, better SEO rankings, and a smoother user experience. On **ruachost.com**, you can apply several optimization techniques to boost speed and efficiency.

## Why Optimize?

- Faster page load times = happier visitors.
- Reduced bandwidth and server resource usage.
- Improved search engine visibility.
- Higher conversion rates for eCommerce sites.

## Key Optimization Techniques

### 1. **Enable Compression**

- Use Apache’s `mod_deflate` to compress HTML, CSS, and JavaScript.
- Add to `.htaccess`:

  ```
  
    AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript
  
  ```
- This reduces file sizes and speeds up downloads.

### 2. **Enable Browser Caching**

- Use Apache’s `mod_expires` to instruct browsers to cache static files.
- Add to `.htaccess`:

  ```
  
    ExpiresActive On
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    ExpiresDefault "access plus 1 week"
  
  ```
- This reduces repeated requests for unchanged files.

### 3. **Minify and Combine Files**

- Minify CSS/JS by removing whitespace and comments.
- Combine multiple files into fewer requests.
- Tools:

  - JSCompress for JavaScript.
  - CSS Minifier for CSS.
  - MinifyCode for HTML, CSS, and JS.

### 4. **Optimize Images**

- Compress images before uploading.
- Use correct formats:

  - JPEG for photos.
  - PNG for graphics with transparency.
  - WebP for modern browsers.
- Tools: TinyPNG, ImageOptim, jpegoptim, optipng.

### 5. **Use Server‑Level Caching**

- **APC** (PHP 5.4 and earlier) → Opcode caching.
- **OPcache** (PHP 5.5+) → Built‑in opcode caching.
- **Memcached** or **Redis** → Advanced caching for dynamic sites.

### 6. **Consider a Managed VPS**

- A **Ruachost Managed VPS** gives your site dedicated resources for faster, more consistent page loads.
- Managed VPS/Dedicated servers can use **Memcached** or **Redis** for even greater speed.

> **Note:**
- The more optimizations you enable, the greater the performance boost.
- Always test changes with tools like **Pingdom**, **GTmetrix**, or **Chrome DevTools**.
- Back up your site before making major configuration changes.
