Last Chance: Cyber Monday 40% OFF

Days
Hours
Minutes

USE CODE: CM2022

Tackle WordPress weaknesses and fortify your website Learn more

The .htaccess file is an important configuration file on Apache servers (a type of web server software). The .htaccess file allows you to adjust/override the web server configuration, without the need to edit the server’s main configuration files.

How do you access the .htaccess file?

There are a few different methods to access the .htaccess file on your server:

  • With a FTP or sFTP client
    • Tip: Use a free & open-source FTP client such as FileZilla or CyberDuck
  • With the File Manager in your webhosting control panel (such as cPanel, Plesk, or DirectAdmin)

Where is the .htaccess file located?

The .htaccess file is located in the root folder of your website. In most cases, this is the public_html folder.

Locating the .htaccess file

Apache hides .htaccess files by default, therefore you may need to enable the “Show Hidden Files” option in the settings of the File Management tool that you’re using.

Changing permissions of the .htaccess file

File Permissions determine who is able to read, write and execute files on the server.

You can change file/folder permissions with an FTP client, or with the built-in File Manager in your webhosting software like cPanel.

The WordPress Codex recommends configuring 644 permissions for the .htaccess file.

Changing permissions of the .htaccess file with an FTP client

Changing permissions of the .htaccess file with an FTP client

FileZilla

Navigate to the .htaccess file, right-click the file and select File permissions…

CyberDuck

Navigate to the .htaccess file, Right-click the file and select Info.

Changing permissions of the .htaccess file within your webhosting software (such as cPanel/DirectAdmin)

cPanel:

Navigate to File Manager, browse to your .htaccess file and select it.

With the file selected, click Permissions in the top menu bar.

DirectAdmin: 

Navigate to File Manager, browse to your .htaccess file and enable the Select checkbox for this file.

Scroll down until you find the Set Permission button, enter the desired permissions in the field and click Set Permission to apply the change.

Changing .htaccess file permissions in DirectAdmin

Editing the .htaccess file

Important: Before making changes to the .htaccess file, make sure to save a (local) back-up of the original file. By doing this, you will be able to revert your changes in case anything unexpected happens.

Locate the .htaccess file on your server, then open the file in any Text Editor to make the desired changes.

Implement your changes outside of the #Begin and #End Really Simple Security comments, or they will be stripped from the file.

Editing the .htaccess file

Table of Contents

Peter Tak

Peter Tak

Security Officer at Really Simple Plugins

Read More

Advanced Security

Tackle WordPress weaknesses and fortify your website. New hardening features!

Definitions

Want to know the in and outs of security jargon? Get to know our features.

Premium support will offer assistance in 24 hours. If you need help, or have any questions just contact our awesome support team/

Related articles