Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Most WordPress .htaccess problems can be repaired by backing up the file, opening Settings > Permalinks, and saving the existing permalink structure. That screen flushes WordPress rewrite rules and rewrites the file when it is writable. If WordPress cannot write it, copy the rules displayed on the screen into the correct .htaccess file through your host’s file manager or an FTP/SFTP client.

How do I fix my WordPress .htaccess file?

  1. Back up the current file. Use your hosting file manager or FTP/SFTP to find .htaccess, download a copy, or rename it to a backup such as .htaccess-before-repair. Enable hidden-file (dotfile) display first; many clients hide this file.
  2. Confirm the installation location. The file is normally in the document root for that WordPress installation, but a site installed in a subdirectory can use a different path. Do not replace a file in another site’s directory.
  3. Open Settings > Permalinks. Leave the desired structure selected and click Save Changes. Visiting this screen flushes rewrite rules; saving also applies the selected structure and lets WordPress update a writable file.
  4. Test the site. Check the home page, one post URL, one page URL, and the URL that previously failed.

What if WordPress says .htaccess is not writable?

WordPress displays the rewrite rules it wants you to use when it cannot update the file. Copy those rules exactly into the .htaccess file for the correct installation, save it, and test again. Preserve any unrelated custom directives outside the WordPress-managed block where possible. Avoid changing broad permissions just to make the file writable; file ownership and server security settings should be checked with your host.

Which WordPress rules belong in a basic Apache .htaccess file?

For a standard single-site installation at the web root, the basic block shown in WordPress Developer Resources is:

# 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 directives enable rewriting, leave index.php alone, allow existing files and directories to be served normally, and send other requests to WordPress’s front controller. Use the rules shown in your dashboard or the current official WordPress example rather than assuming this root-installation block fits every site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When this block is not appropriate

  • Subdirectory installations: the rewrite base and front-controller path must match the directory where WordPress is installed.
  • Multisite: a network using subfolders needs different rules from one using subdomains. Single-site rules are not interchangeable with all Multisite layouts.
  • Custom hosting rules: caching, security, redirects, or authentication directives may need to remain in the file. Back up and review them before replacing anything.

Why are my WordPress permalinks returning 404?

If the home page works but post or page URLs return 404, the rewrite rules may be missing or stale, or Apache may not be processing them. Refresh the rules through Settings > Permalinks first. If that does not help, ask the hosting provider to verify that Apache mod_rewrite is enabled and that the site is allowed to use the required per-directory configuration. Hosting providers must configure the server for Pretty or Almost Pretty Permalinks; editing the file alone cannot compensate for a disabled module or restricted server setting.

Use this 404 decision path

Symptom Next action
Dashboard is available and the file is writable Open Settings > Permalinks, confirm the structure, and save it.
Dashboard reports that the file is not writable Copy the displayed rules into the correct file using hosting file access.
Pretty URLs still return 404 Ask the host to check Apache mod_rewrite and per-directory configuration.
The file appears to be missing Turn on hidden-file display and verify the installation directory before creating a new file.

How do I troubleshoot a WordPress HTTP 500 after editing .htaccess?

A 500 response does not prove that .htaccess is the cause. Treat it as one possibility alongside plugin, theme, PHP, and other server errors.

  1. Check the server error log at the time you reproduce the failure. The log can identify a syntax error, denied directive, PHP fatal error, or another server-side cause.
  2. Test for plugin conflicts. If you can reach the dashboard, deactivate plugins and reactivate them one at a time. If you cannot, use your host’s file access to rename the plugins directory temporarily, following WordPress’s troubleshooting procedure.
  3. Test the active theme. Temporarily switch to a standard theme when the dashboard is available, or use the host/database method appropriate to your installation.
  4. Test the file itself. Rename .htaccess temporarily and request the site. If the error disappears, the file or one of its directives is implicated; if it remains, continue with logs, plugins, themes, and server configuration.
  5. Restore the intended configuration. A renamed file is only a diagnostic step. Restore the backup or regenerate the correct rules through Settings > Permalinks once the cause is identified.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When should I contact my hosting provider?

Contact the host when you cannot access file storage or logs, do not control Apache configuration, the rewrite module may be disabled, or the host restricts directives used in .htaccess. Provide the failing URL, response code, reproduction time, WordPress installation path, and relevant error-log entry. This gives support enough context to distinguish a rewrite problem from a PHP or application failure.

How to prevent the next .htaccess outage

  • Download a dated backup before changing rewrite, redirect, security, or caching directives.
  • Keep custom rules separate from the WordPress-managed block when the application or host permits it.
  • After every change, test the home page, a post, a page, login, and any custom route affected by the change.
  • Record whether the site is single-site or Multisite and whether WordPress is installed at the domain root or in a subdirectory.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.