How To Fix A Corrupted .htaccess File

Are your experiencing an internal server error or Forbidden 403 error on your WordPress site? You may need to fix a corrupt .htaccess file. This tutorial shows you how …

How To Fix A Corrupted .htaccess FileThis tutorial is part of our FREE WordPress Management training and WordPress Troubleshooting tutorial series.

In this series of step-by-step tutorials, we show you how to troubleshoot and fix common WordPress errors.

Info

Important: Always back up your WordPress site (files and data) before modifying any files or performing any upgrades or installations! 

If you don’t want to back up your site manually, then get professional WordPress support, or use backup plugins.

How To Fix A Corrupted .htaccess File

As WPCompendium.org is a resource for non-technical WordPress users, we have kept the information below as simple as possible. For technical tutorials on .htacess files, search online, or go here: .htaccess Guide

What Is An .htaccess File?

An .htaccess file is a configuration file used on web servers running the Apache Web Server software. It’s a text file that contains important server instructions …

WordPress .htaccess file

(WordPress .htaccess file)

What Does An .htaccess File Do?

An .htaccess file is used to enable/disable functionality and features in the Apache Web Server software. This includes things like:

  • Enable password protection on a directory
  • Enable content protection
  • Deny visitors access to the website
  • Redirect visitors to another page or a custom error or 404 page
  • Prevent images on your site from being hotlinked
  • Etc.

The .htaccess file can include additional information and instructions depending on the applications installed on your server …

An .htaccess file contains server instructions

(An .htaccess file contains server instructions)

How Do You Access The .htacces File?

The .htaccess file is normally found in the root directory of your domain alongside WordPress folders like wp-admin, wp-content, and wp-includes

.htaccess file

(.htaccess file)

You can access your .htaccess file inside your server using cPanel or an FTP program. If you need help with this, see the tutorial below:

Important Info

Depending on your FTP software settings, files like .htaccess may be hidden. To display hidden files, click on ‘Tools’ (or ‘Settings’) …

Sometimes .htaccess files are hidden

(Sometimes .htaccess files are hidden)

Select Tools > Options

FTP Tools > Options

(FTP Tools > Options)

Enable the ‘Show hidden files’ checkbox and click ‘Save’ to update your settings …

Enable 'show hidden files' option

(Enable ‘show hidden files’ option)

Your .htaccess file should now be visible …

.htaccess file

(.htaccess file)

Fixing A Corrupted .htaccess File

Sometimes, the .htaccess file can become corrupted. There are many reasons why an .htaccess file can become corrupted and this can happen while a plugin is being installed, or if the file has not been configured properly, or even if an internet connection drops out while things are being written to your server.

When the .htaccess file becomes corrupted, it can lead to errors such as:

If your .htaccess file has become corrupted, here’s a simple way to fix it.

First, access your WordPress installation via cPanel or FTP (go here if you need help with this step) …

Access your WordPress installation files using cPanel or FTP

(Access your WordPress installation files using cPanel or FTP)

Next, locate the .htaccess file. You can simply delete this file or rename it to something else (e.g. “.htaccess_old”).

To rename the file, right-click on the file and select ‘Rename’ …

Select .htaccess and click Rename

(Select .htaccess and click Rename)

Rename the file to something like .htaccess_old

Rename .htaccess file

(Rename .htaccess file)

Next, log into your WordPress site, then go to Settings > Permalinks and click ‘Save Changes’  …

(Resave your WordPress Permalinks settings

(Resave your WordPress Permalinks settings)

You don’t need to change any Permalink settings. Resaving your settings will generate a new .htaccess file on your server automatically.

To check this, go back to your server and refresh the screen …

Refresh FTP screen

(Refresh FTP screen)

You should see the new .htaccess file in your server directory …

New .htaccess file

(New .htaccess file)

Remember to delete the old .htaccess file from your server before closing your FTP or cPanel application …

Delete the old .htaccess file

(Delete the old .htaccess file)

Return to your WordPress site and check to see if this has fixed the problem. If the problem has not been fixed, refer to other tutorials on our WordPress Troubleshooting Guide, or contact your webhosting provider.

More WordPress Troubleshooting Tutorials

If you experience any other issues or errors with WordPress, refer to the tutorials in the section below:

How To Fix A Corrupted .htaccess File

(Source: Pixabay)

***

"Learning WordPress has been a huge stumbling block for me. I've been looking for something that covers absolutely everything but doesn't cost an arm and a leg. Thank you so much ... you have just provided me with what I have been looking for! Truly appreciated!" - Tanya

***

Recommended Video Courses For WordPress Users

How To Use cPanelHow To Use cPanel

cPanel is a powerful and simple-to-use web hosting management software application that gives website owners the ability to quickly and easily manage their servers and websites using a simple and intuitive dashboard.

This video course will teach you how to use the main features of cPanel to manage your web hosting.

More info: How To Use cPanel

Recommended Video Courses For WordPress Users

Google ToolsGoogle Tools

This video course will help you learn the basics of using Google Tools like Google Analytics and Gmail.

More info: Google Tools

Recommended Video Courses For WordPress Users

How To Set Up WordPress On LocalhostHow To Set Up WordPress On Localhost

Learn how to install, set up, and locally host a fully functioning WordPress site on your computer.

More info: How To Set Up WordPress On Localhost

Recommended Video Courses For WordPress Users

How To Back Up & Restore WordPress SitesHow To Back Up & Restore WordPress Sites

Learn how to safely and automatically backup your WordPress files and database and how to easily restore your WordPress site if something were to happen.

More info: How To Back Up & Restore WordPress Sites

Recommended Video Courses For WordPress Users

How To Install, Set Up & Use WordPress MultisiteHow To Install, Set Up & Use WordPress Multisite

Learn how to quickly and securely set up an online community of websites or blogs using the powerful WordPress Multisite feature.

More info: WordPress Multisite

Recommended Video Courses For WordPress Users

WordPress SecurityWordPress Security

Learn how to keep your WordPress site or blog secure and protected from malware, hackers and brute-force attacks.

More info: WordPress Security

Recommended Video Courses For WordPress Users

How To Optimize WordPressHow To Optimize WordPress

Learn how to optimize your WordPress site and improve your page loading speed.

More info: How To Optimize WordPress

Recommended Video Courses For WordPress Users

Using Password ManagersUsing Password Managers

Password Managers provide an easy and secure way to keep track of all your passwords. This video course shows you how to use two FREE powerful password management tools.

More info: Using Password Managers

Recommended Video Courses For WordPress Users

How To Use Amazon S3How To Use Amazon S3

Learn how to set up and use Amazon S3 to upload, store, manage, and protect your site’s images, large media files, downloadable files, stream videos and more.

More info: How To Use Amazon S3

Recommended Video Courses For WordPress Users

How To Use FTPHow To Use FTP

This video course shows you how to use FTP (File Transfer Protocol) to transfer and upload files between your hard drive and your server using a free FTP program called Filezilla.

More info: How To Use FTP

Author: Martin Aranovitch

Martin Aranovitch is the founder of WPCompendium.org and the author of The Small Business Digital Manager. WPCompendium.org provides hundreds of FREE tutorials that show you how to use WordPress to grow your business online with no coding skills required! Get our FREE "101+ WordPress Tips, Tricks & Hacks For Non-Techies" e-course with loads of useful WordPress tips!

Originally published as How To Fix A Corrupted .htaccess File.