---
title: "I get a 404 error or “Not Found” when visiting my site"
source: "https://docs.nexcess.com/sites-stores/stellarsites/i-get-a-404-error-or-not-found-when-visiting-my-site/"
description: "If your WordPress site suddenly starts showing 404 Not Found errors across all or most pages, a missing or incorrect .htaccess file may be the cause. The .htacc…"
vertical: "Sites & Stores"
date: "2025-09-22"
last_modified: "2026-07-23"
---

# I get a 404 error or “Not Found” when visiting my site

If your WordPress site suddenly starts showing **404 Not Found** errors across all or most pages, a missing or incorrect `.htaccess` file may be the cause. The `.htaccess` file is a hidden configuration file that controls how Apache (the web server software used by StellarSites) handles requests for your site.

When the `.htaccess` file is missing important WordPress rules, the server can’t properly route requests to WordPress, leading to site-wide 404 errors.

## The Fix: Restore WordPress Default Rules

To restore proper functionality, you need to make sure the `.htaccess` file includes the WordPress default configuration.

At a minimum, add the following lines to your `.htaccess` file (usually located in your site’s root directory, alongside `wp-config.php`):

```
# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
```

These rules tell Apache to:

- Enable URL rewriting (`RewriteEngine On`).
- Pass along HTTP authorization headers if present (necessary for some plugins and APIs).
- Route all non-file and non-directory requests to `index.php`, which allows WordPress to handle them.

### How to Edit .htaccess

- Use an **SFTP client** (like FileZilla, Cyberduck, or Transmit) to connect to your server.
- Or use **SSH command line access** to open and edit the file directly.

See [SSH Access and Command Line Tools for StellarSites](https://docs.nexcess.com/sites-stores/stellarsites/ssh-access-and-command-line-tools-for-stellarsites/) for instructions on retrieving your SSH/SFTP credentials and setting up your SFTP tool.

## Alternative Fix: Regenerate .htaccess from WordPress

If you prefer not to edit files directly and are able to access your WordPress admin area:

1. Log into the WordPress admin dashboard.
2. Go to **Settings → Permalinks**.
3. Without changing anything, click **Save Changes**.

WordPress will attempt to regenerate the `.htaccess` file with the correct rules.

## Why This Matters

Without the correct `.htaccess` rules, WordPress cannot process URLs properly. Restoring them ensures that:

- All posts, pages, and custom content types load normally.
- Permalink structures (pretty URLs) work as expected.
- Plugins and APIs relying on rewrite rules function correctly.
