The .htaccess file is a configuration file read by the server. It is able to override many server configuration settings and can be used for authorization, cache control, website optimization, and URL rewriting.
In WordPress, the .htaccess file is used most commonly for rewriting URLs, making them cleaner, and more readable by humans and search engines.
In the Settings > Permalinks section of the WordPress Administration, you have the option to select your URL structure. WordPress will automatically rewrite your .htaccess file to handle the URL structure you select.
If WordPress is unable to write to the file, it will ask you to do it manually. Manually editing the .htaccess file is risky, as it can cause major server errors if configured incorrectly, so be sure to only copy the contents WordPress advises you to.
Plugins such as W3 Total Cache will modify your .htaccess file in order to configure the caching and optimization tools that are part of the plugin.
The .htaccess file is usually found in the root directory of your WordPress site. Your FTP client may not be able to show it, as by default all files and directory names starting with a period are considered hidden by the server. To view these hidden files you need to enable show hidden files option in your FTP client.
This post was originally published in the wpbeginner glossary.