Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to restore the default WordPress .htaccess file

If your WordPress links give 404 errors, or your site shows a server error, a fresh .htaccess file often helps. This guide shows two ways to make one.

cPanel2 min read13 steps

What is .htaccess?

.htaccess is a small settings file for the Apache web server. Apache is the program that sends your pages to visitors. WordPress uses this file to make pretty links, like yoursite.com/about. If the file is missing or broken, those links stop working. The file starts with a dot, so File Manager may hide it.

Warning: Back up your current .htaccess before you change it. Other plugins may have added rules that you will lose.

Method 1: Let WordPress make it

  1. Log in to cPanel and open File Manager.
  2. Click Settings at the top right. Tick Show Hidden Files (dotfiles). Save.
  3. Go to the folder where WordPress lives. This is often public_html.
  4. Right-click .htaccess and choose Rename. Call it .htaccess-old. This is your backup.
  5. Log in to your WordPress dashboard.
  6. Go to Settings then Permalinks.
  7. Do not change anything. Click Save Changes.

WordPress writes a new .htaccess file. Test your links.

Method 2: Make the file by hand

  1. In File Manager, click + File.
  2. Name it .htaccess and click Create New File.
  3. Right-click the file and choose Edit.
  4. Paste this default code.
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    This is the standard single-site WordPress rule set.
  5. Click Save Changes.
  6. Open your site and test a few pages.

If your site is in a sub-folder

Change RewriteBase / to the folder name, for example RewriteBase /blog/. Also change the last rule to /blog/index.php.

If it still fails

Tip: Multisite WordPress uses different rules. Do not use this code for a multisite network.

Quick recap

  • .htaccess controls pretty links in WordPress.
  • Rename the old file, then re-save Permalinks to get a new one.
  • Or paste the default code by hand.
  • Always keep a backup of the old file.