How To Find And Restore WordPress htaccess File


Bart Keating


2019 February 11th


The WordPress htaccess file stores lots of powerful settings associated with your WordPress server.

In this tutorial, you'll find how to find and restore htaccess to its default configuration.

Here's a quick summary of how to access your WordPress htaccess file:

  1. Create a WordPress database backup
  2. Log in to your server's control panel
  3. Open your server's file manager
  4. Alternate step: Login to your server's FTP system
  5. Locate the htaccess file

1. Create a WordPress Database Backup

The method detailed here involves entering your server's file storage system which contains lots of important files and settings related to your WordPress account.

Therefore, I recommend you create a full backup of your WordPress database before getting started.

2. Log in to Your Server's Control Panel

The first step to accessing your htaccess file is to open your server's control panel.

To do this, you'll need to use the credentials you set when you first opened your account.

Can't remember what they are?

If you've forgotten your user name or password, submit a support ticket to your hosting provider to have them reset.

Once you've opened the control panel, you should see a screen like the one below:

WordPress htaccess cPanel Root

But if your server's control panel is different, don't worry. 

cPanel (shown above) is used by most, but not all web hosts. If your host uses a different piece of server management software, you'll still be able to follow the next steps.

3. Open your Server's File Manager

In your control panel, look for an icon labeled 'File Manager' or 'Files' and click it.

This will open your host's file management software which should allow you to view your WordPress system files.

WordPress htaccess Open File Manager

4. Alternate Step: Log in to Your Server's FTP System 

At this stage, ideally, you'll be greeted with a window that shows your WordPress system files.

You'll know if you're looking at the right directory because there should be folders beginning with 'wp_', such as 'wp_posts'.

If amongst the other files and folders you see is a file named '.htaccess', you can skip this step.

However, with some web hosts, the htaccess file is set to be hidden by default, so you won't be able to view it through the inbuilt file manager.

In that case, you'll have to make use of your server's FTP client instead. To access it, select an icon labeled 'FTP' or 'FTP accounts' on your control panel. 

WordPress htaccess Open FTP Accounts

You'll be taken to a page that will allow you to create login credentials for your FTP server. Fill in a new password and username then click 'Create FTP Account'.

WordPress htaccess FTP Accounts

You can now copy the URL shown at the top of your page into your browser address bar and log in to the page using the FTP details. You can also access the FTP server with a client like FileZilla if your server doesn't have an inbuilt FTP interface. 

5. Locate the htaccess File

Now that you've reached your server's file system (either through your file manager system or via FTP), you should be able to see the various files stored in your root directory.

One of these should be labeled '.htaccess'.

WordPress htaccess File Manager

Congratulations, you have now accessed your htaccess file!

To modify it, you can right-click on it and press 'edit', or download it and modify it offline. 

Additional Steps: Restoring the Default WordPress htaccess file

Because htaccess is such a vital WordPress file, if it becomes corrupted or goes missing, it can prevent you from accessing your WordPress site.

Such an error may occur for a number of reasons.

For example, if WordPress didn't install properly the creation of htaccess may have been skipped altogether. The htaccess file may also become damaged when migrating your WordPress site from one web host to another, or if a plugin malfunctions.

If you find that your htaccess file is corrupt, don't panic! I

t's easy to restore the default WordPress htaccess file by following these steps:

  1. Copy your current htaccess file to another location
  2. Create a new htaccess file
  3. Paste the default htaccess code into your new file

1. Copy your htaccess File to Another Location

Note: this step only applies if you have a malfunctioning file rather than a missing one.  

Prior to attempting to restore your default htaccess file, I recommend you back up your current htaccess file. Even if it isn't working in its current configuration, it may still contain important information about your server settings.

To create a copy of your current htaccess file, right click on the file in your FTP or file manager window and select 'download'.

WordPress htaccess Download

You can now rename the old file something like 'htaccess_original' so that you'll be able to find it again at a later stage, if and when you need to.

2. Create a New htaccess File

Now you need to make an empty file. You can do this by opening a new file on your computer using a text editor (and uploading it to your server's root directory) or by right-clicking in your file manager/ FTP client and selecting 'create new file'.

Once you’ve done that, name your new file '.htaccess'

WordPress htaccess Name File

3. Paste the Default htaccess Code into Your New File

The final step to restoring your htaccess file is to paste the default WordPress htaccess code into it. To do that, right-click on the file and select 'edit'.

WordPress htaccess File Edit

Next, paste the following code into your file:

# 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]
# END WordPress

You should now see the following screen:

WordPress htaccess Save New File

To finish, click 'SAVE & CLOSE'  and... Voila!

You're done!

You've successfully restored the default htaccess file.

But what is the htaccess File?

If you ran into a htcaccess issue, but still don't really know what it is, this part of the post will help you find out more about what htaccess is.

The htaccess file is used by any software installed on an Apache web server to reconfigure the server's settings. It controls some of WordPress's core functions, determining how it interprets different URLs and where it stores data.

For example, the htaccess file contains lots of your WordPress site's most important security and user privilege settings. If modified, the htaccess file can be used for many different purposes.

Here are WordPress htaccess examples for things you can do when working with htaccess file:

  • Change the maximum file size allowed on your WordPress account
  • Ban particular IP addresses from accessing your site
  • Prevent external hotlinking to images in your posts
  • Password protect different WordPress folders
  • Redirect readers to a customized error page

But remember, if at a later date you modify your htaccess file for any of the above purposes, create a backup of its current version before you begin. This way you'll be able to customize your htaccess file without the fear of losing your other settings!

Leave a Comment

* your email will not be displayed