Default Wordpress .htaccess

Default WordPress .htaccess Rules Explained

WordPress relies on a special set of rewrite rules inside the .htaccess file to enable permalinks, route URLs correctly, and load your content through index.php. If this file becomes corrupted, your site may display 404 errors or fail to load pages.

Below is the default WordPress .htaccess block:

# BEGIN WordPress

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

What These Rewrite Rules Do

  • RewriteEngine On — enables Apache’s rewrite engine.
  • RewriteBase / — sets the root folder as the rewrite base.
  • RewriteCond %{REQUEST_FILENAME} !-f — if the file does NOT exist…
  • RewriteCond %{REQUEST_FILENAME} !-d — and the directory does NOT exist…
  • RewriteRule . /index.php — route the request through WordPress.

When You Should Restore the Default .htaccess

Restore your .htaccess if you experience:

  • 404 errors on all pages or posts
  • Permalinks not working after migration
  • Corrupted rewrite rules caused by plugins
  • Missing .htaccess file

How to Restore the Default .htaccess File

  1. Log in to cPanel.
  2. Open File Manager.
  3. Navigate to public_html or your WordPress folder.
  4. Right-click the .htaccess file → Edit.
  5. Replace its contents with the default WordPress block.
  6. Click Save.

Regenerating .htaccess Inside WordPress Admin

  1. Log in to wp-admin.
  2. Go to Settings → Permalinks.
  3. Click Save Changes (no need to modify anything).

WordPress will recreate a correct and complete .htaccess file automatically.


Notes & Tips

  • If WordPress is installed in a subfolder, adjust RewriteBase accordingly.
  • Caching or security plugins may append extra rules — this is normal.
  • When using WooCommerce or custom post types, always refresh permalinks after changes.

Boost Your WordPress Performance

Check out our fully optimised WordPress hosting plans with automatic updates, security tools and speed enhancements.

Explore WordPress Hosting & Toolkit →
Was this article helpful?

mood_bad Dislike 0
mood Like 0
visibility Views: 5091

Need more information or have a question ?