
You have just installed WordPress, configured the basic settings, and created your first page. But when you try to visit it, you get a 404 error. The homepage opens fine, but all internal pages show a "Page not found" message. This is one of the most common issues when launching a new site, and it is easily fixable.
Quick Fix
In most cases, the problem is solved in half a minute:
- Log in to your WordPress admin dashboard.
- Go to Settings and select Permalinks.
- Without changing anything in the fields, simply click the Save Changes button.
If this did not help, keep reading. Below is a detailed breakdown of all possible causes and how to fix them.

Why WordPress shows a 404 error on internal pages
A 404 error on all pages except the homepage is almost always a failure in the permalink system. WordPress uses a URL rewriting mechanism to turn pretty URLs like site.com/my-post/ into system-readable queries. When this chain breaks, the server cannot find the requested file and returns a standard error.
A 404 error on all internal pages almost always means that the server does not understand how to pass a pretty URL to index.php. As long as WordPress works through its routing handler, everything is fine. As soon as this chain breaks, the server honestly looks for a file at that path, does not find it, and returns a standard 404.
Main causes of the failure:
- Rules in the .htaccess file were lost or never created (relevant for Apache servers). This often happens after migrating a site or manually editing files.
- The required try_files block is missing in the Nginx configuration. This is typical when moving from shared hosting to a VPS.
- Rewrite rules in the database are corrupted due to plugin conflicts or an improper update.
Step-by-step diagnostics and fixes
To find and eliminate the cause of the failure, move from the simplest actions to more complex ones. In most cases, the problem is solved in the first or second step.

Step 1. Resave permalink settings
This is the first action you need to take. Even if you think the settings are correct, WordPress automatically recreates rewrite rules and updates configuration files upon saving.
[Image note 3: Step-by-step screenshot with navigation in the menu: Settings → Permalinks]
- In the admin panel, go to Settings → Permalinks.
- Leave the current structure as is (usually "Post name").
- Click Save Changes.
In 70% of cases, this is enough. If the page still does not open, move to the next step.
Step 2. Check and restore the .htaccess file
The .htaccess file is located in the root WordPress folder, right next to wp-config.php and the wp-content folder. This is a hidden file, so make sure your FTP client or hosting file manager is set to display hidden files.
| What to check | Correct value |
|---|---|
| File presence | Must exist in the site root |
| File permissions | 644 (read for all, write for owner) |
| WordPress block | Must contain standard RewriteRule rules |
| Location | Root WordPress folder (next to index.php) |
Table 1. Parameters for checking the .htaccess file
Open the file and make sure it contains the following code:
# BEGIN WordPress
<IfModule mod_rewrite.c>
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]
</IfModule>
# END WordPress
If the file does not exist at all, create it manually with this content. If the file exists, but the code is missing or cut off, paste the entire block.
Important: if WordPress is installed in a subfolder (for example, site.com/blog/), change the line RewriteBase / to RewriteBase /blog/, and in the rule specify RewriteRule . /blog/index.php [L].
Step 3. Check Apache server settings
Even a perfect .htaccess file will not work if the server ignores it. The main Apache configuration must allow the processing of such files.
"AllowOverride None is the most common reason why changes in .htaccess simply do not work. Make sure that AllowOverride All is enabled in the Apache config for the site directory." From developer discussions on StackOverflow
What you need to check:
- Open the main Apache configuration file (usually /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf).
- Find the <Directory "/path/to/your/site"> block.
- Make sure it says AllowOverride All, not None.
- Check that the mod_rewrite module is enabled (the line LoadModule rewrite_module modules/mod_rewrite.so should not be commented out).
- Restart Apache with the command sudo systemctl restart apache2.

Step 4. Configure Nginx
Nginx servers do not read .htaccess files. This is a feature of their architecture. If you moved your site from shared hosting to a VPS with Nginx, the old rules simply will not work.
| Parameter | Apache | Nginx |
|---|---|---|
| Configuration file | .htaccess in site root | /etc/nginx/sites-available/your-site |
| Rewrite mechanism | mod_rewrite | try_files directive |
| Applying changes | Automatically (if permissions allow) | Requires syntax check and service reload |
| Syntax check | Not required | Mandatory nginx -t before reload |
Table 2. Configuration comparison for different web servers
Add the following block to your site's configuration:
location / {
try_files $uri $uri/ /index.php?$args;
}
After making changes:
- Check syntax with the command nginx -t.
- Reload configuration: sudo systemctl reload nginx.
The path to the PHP-FPM socket depends on the PHP version and OS distribution. Check it in the output of the command systemctl status php8.1-fpm or in the pool file.
Step 5. Look for hidden causes
If all previous steps did not help, the problem might be deeper.
Plugin or theme conflict. Some plugins that register custom post types or change the URL structure can conflict with the permalink system.
- Via FTP, rename the /wp-content/plugins folder to plugins_old. This will disable all plugins.
- Check if the 404 error is gone.
- If yes, restore the original folder name and enable plugins one by one, checking the site after each activation.
PHP and WordPress version incompatibility
If you are using PHP 8.0 or higher with an outdated WordPress version (below 5.6), query processing issues may occur. Full official PHP 8 support was only introduced in WordPress 5.6.
Physical files in the site root
If there is a file in the WordPress root folder with a name matching a page URL (for example, contact.php when you have a /contact/ page), the server might prioritize the physical file. Check the root folder for such conflicts.
How to avoid this problem in the future
The 404 error problem often arises from low-quality extensions that handle routing incorrectly. When choosing tools for your site, pay attention to update frequency and user reviews regarding compatibility.
All extensions in the IWS.BY catalog undergo thorough compatibility testing with the WordPress core and popular page builders. This minimizes the risk of conflicts and ensures stable site operation without unexpected crashes.
Before making any changes to configuration files, be sure to back up your site and database. This will allow you to quickly restore functionality in case of an error.