Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

What is: .htaccess

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

.htaccess is a configuration file used by the Apache web server. It’s a hidden file located in the root folder of your website and contains rules about how the web server should function.

WordPress automatically stores some of its settings in .htaccess, and advanced users can edit the file manually to configure their website and solve problems.

Other web servers don’t use the .htaccess file. For example, if your WordPress hosting provider uses Nginx or Microsoft Windows Server, then your site will not have a .htaccess file.

What Is .htaccess in WordPress?

How WordPress Uses the .htaccess File

WordPress automatically stores some of its settings in the .htaccess file. For example, it uses .htaccess when it rewrites URLs to make them more readable by humans and search engines.

When you navigate to Settings » Permalinks and select the URL structure for your blog, WordPress automatically rewrites your .htaccess file to handle the URL structure you choose.

WordPress Stores Permalink Settings in .htaccess

Also, 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.

How to Manually Configure the .htaccess File

Manually editing the .htaccess file is risky, as it can cause major server errors if configured incorrectly. We recommend you download a copy of your .htaccess file to your computer as a backup. You can use that file in case anything goes wrong.

Sometimes, WordPress is unable to write to the .htaccess file and will ask you to do it manually. Be careful only to copy the exact contents given to you by WordPress.

You can also see our guide on the most useful .htaccess tricks for WordPress, where we share code snippets that let you tweak your website. We show you how to password-protect your WordPress admin area, set up redirects, ban suspicious IP addresses, and more.

Beyond that, when you search WPBeginner for .htaccess, you’ll find dozens of articles that show you how to edit .htaccess to improve your site and solve specific problems.

How to Access the .htaccess File

To access the .htaccess file, you’ll need to use an FTP client like FileZilla or the file manager option in your WordPress hosting control panel.

If you haven’t used FTP before, then you may want to see our guide on how to use FTP to upload files to WordPress.

You Access .htaccess Using an FTP Client

Tip: The All in One SEO plugin also has a tool for editing .htaccess.

You should find .htaccess in the root directory of your WordPress site. However, your FTP client may not initially show the file since file names starting with a period are considered hidden by the server.

If you can’t see these hidden files, then you will need to enable the ‘show hidden files’ option in your FTP client. If you still cannot find your .htaccess file, then see our guide on how to find the .htaccess file in WordPress.

We hope this article helped you learn more about .htaccess in WordPress. You may also want to see our Additional Reading list below for related articles on useful WordPress tips, tricks, and ideas.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Additional Reading

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!