How to restore the default .htaccess file for WordPress

Learn how to restore the default .htaccess file for WordPress in this quick and easy tutorial.

If your WordPress site encounters an issue such as a malware infection or a plugin issue, your .htaccess file might be corrupted or malformed to the point where the site does not function correctly.

In such cases, you can try restoring the .htaccess file to its default state.

WordPress default .htaccess file

The default .htaccess file that comes with WordPress is as follows:

# 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

Removing unwanted .htaccess files

The above .htaccess file should exist in your domain’s folder. There should not be any .htaccess files in the domain’s subfolders.

If you find a .htaccess file in one or more of the domain’s subfolders, they are likely to be rogue and may need to be deleted to restore site functionality.


You may also like:


Love our articles? HostM offers professional and helpful web hosting services with unlimited features and renewal rates that actually match our advertised rates.