# About the '403 Forbidden' error message

> Find out what causes a 403 Forbidden error and fix it by checking index files, permissions and .htaccess rules.

Source: https://helpcenter.ruachost.com/developers/web-servers/about-the-403-forbidden-error-message/

A **403 Forbidden** error occurs when a web server denies access to a requested resource. On **ruachost.com**, this typically means that permissions or configuration settings are preventing visitors from viewing a file or directory.

## Common Causes of 403 Errors

- **Missing index file**: No `index.html` or `index.php` exists in the directory.
- **Incorrect file permissions**: The `.htaccess` file or `public_html` directory has restrictive permissions.
- **Directory permissions misconfigured**: The directory may be set to `644` instead of `755`.
- **Access restrictions in** `.htaccess`: Rules may block visitors from certain files or directories.
- **IP or country blocking**: Access may be restricted based on visitor location.

## How to Resolve a 403 Error

### Step 1: Check for an Index File

Ensure your site’s root directory contains an index file:

- `index.html`
- `index.php`

Without one, Apache will deny access.

### Step 2: Verify File Permissions

- `.htaccess` should be set to:

  ```bash
  chmod 644 ~/public_html/.htaccess
  ```
- `public_html` directory should be set to:

  ```bash
  chmod 755 ~/public_html
  ```

### Step 3: Review `.htaccess` Rules

- Look for `Deny from all` or restrictive rules.
- Remove or adjust them if they block legitimate visitors.

### Step 4: Check Server Logs

- Use **cPanel → Metrics → Errors** or SSH to view Apache error logs.
- Logs will show the exact reason for the 403 error.

### Step 5: Test Access

- Clear browser cache and cookies.
- Retry accessing the site.
- If using a CDN (like Cloudflare), purge cache there as well.

> **Important Notes:**
- A 403 error indicates **permission denied**, not that the file is missing.
- Always back up `.htaccess` before editing.
- If you’re on shared hosting, contact Ruachost support if permissions appear correct but the error persists.
