• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

WP Thinker

The WordPress Playground

  • Snippets
  • Best
  • Guides
  • Reviews
Home / Guides

June 17, 2020 Muhammed Swalih

Default WordPress .htaccess File

Default-.htaccess

.htaccess is one of the most important files on your WordPress installation. A file that can make your website go down with a single mismatched configuration or invalid letter in it. So, you should be very careful while playing with the .htaccess file or making changes to it. It doesn’t mean that you shouldn’t touch the file. It is necessary to make changes to .htaccess to protect your website, block IPs, speed it up, and do a couple of other things. So, leaving it as it is may not be possible in every scenario.

In this article, we are going to give you the default .htaccess file which you can use in case you made any mistakes and your website is no more running. If you tried making changes to your website and facing issues because the .htaccess file is corrupted, you could just copy-paste the following code to your .htaccess file by removing the entire code in it. This will reset the .htaccess file to its default and any complications caused by an invalid .htaccess configuration will be resolved.

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

If you are using a WordPress caching plugin such as WP Rocket, it will automatically put certain codes in your .htaccess file between something like /*WP Rocket Code*/. So, you shouldn’t be worrying about those extra lines you see on your .htaccess file. You may take a backup of the .htaccess before resetting it to default state. So that you could consult with a developer or someone who is experienced with such tasks and implement any changes you made to the file correctly.

When should you use the default .htaccess

Whenever you face some issues on your website after making changes to the .htaccess file to accomplish something. You should either revert back all the changes you made to the file or completely reset the .htaccess file to its default. If reverting the changes in the file doesn’t seems to be working, or if you are not sure what changes you made to the file, take a backup of the current .htaccess and copy paste the above code to the file and save the changes. This should make your website running fine again if the problem was caused by the .htaccess file. If not, you should diagnose the issue further.

Is it safe to make changes to .htaccess?

It is completely normal to make changes to the file according to the recommended rules. Do not just copy paste some random codes you found on the web. Whenever you are copying something from a website, make sure that the website is trusted. Implementing codes from any sneaky websites might cause you harm especially if you are new to such things. So, it is safe to make changes to the .htaccess file on your WordPress root directory only if you are going to be careful while making changes to it and use only trusted codes from trusted WordPress related websites.

Avatar for Muhammed Swalih

Muhammed Swalih

A WordPress expert who has been tweaking WordPress functions, plugins, themes and almost everything related to WordPress for the past 5+ years.

Primary Sidebar

Related Articles

Footer

WP Thinker is a website that publishes everything related to WordPress, Plugins, Themes, SEO, Blogging, etc.

  • Facebook
  • Twitter
  • Pinterest

Copyright © 2023 · WP Thinker

  • About Us
  • Advertise
  • Write for Us
  • Privacy Policy
  • Terms and Conditions
  • Contact Us
This website uses cookies to serve you better. By continuing to use this website, you agree to our cookie and Privacy Policy.