One of the most common questions we get asked by beginners is, ‘Where is my .htaccess file?’ Not being able to find it can be frustrating, as you may need to edit or delete it to fix common WordPress errors.
The .htaccess file plays a crucial role in managing various aspects of your website, from permalinks to security settings.
In this article, we will explain why you can’t find the .htaccess file on your WordPress site and show you how to locate it.
What Is the .htaccess File?
The .htaccess file is a server configuration file that tells your server how to handle certain tasks on your website.
Some tasks this PHP file can handle include managing permanent links, redirecting users, password-protecting the admin area, and more. Think of it as an instruction manual for your web server.
The standard .htaccess file location is in the WordPress.org site’s root folder.
Why Can’t I See My .htaccess File?
If you can’t see your .htaccess file, it’s most likely because it may be hidden by your FTP or file manager. Or it doesn’t exist, and you may need to refresh your permalink settings.
We will explain both of these scenarios with solutions to locate the file. Feel free to use these quick links to skip to a specific scenario:
👨🔧 Need help maintaining your WordPress website? WPBeginner Pro Services offer solutions for you to keep your website safe and optimized, from WordPress maintenance and hacked site repair to emergency support.
Feel free to book an appointment with our team today to see what solution is best for your website!
Scenario 1: Your FTP or File Manager Is Not Showing Hidden Files
The dot before the .htaccess file name indicates that it is a hidden file. By default, when you connect to your WordPress hosting server using an FTP client, it will not show the hidden files.
To make hidden files visible, you will need to change your FTP settings.
In FileZilla, you can find this option by clicking on the ‘Server’ menu item and then selecting ‘Force showing hidden files’.
For other FTP clients, you will find the option to show hidden files in the app settings or preferences menu. After enabling this option, you will be able to view all hidden files, including the .htaccess file for your WordPress website.
To those using the cPanel File Manager app, you will find the option to show hidden files.
If you use Bluehost, you can simply go to the ‘Websites’ tab and click on the ‘Settings’ button on the website you want to edit.
Next, scroll down the page.
Then, click on the ‘File Manager’ button.
Here, you can click on the ‘Settings’ button in the top-right corner.
After that, go ahead and enable the ‘Show Hidden Files’ option.
Scenario 2: The .htaccess File Doesn’t Exist
The second most common reason for a missing .htaccess file is that your WordPress site has not generated it yet.
WordPress automatically generates a .htaccess file because it is required to properly redirect permalinks.
If your .htaccess file is missing, then the first thing you need to do is to visit Settings » Permalinks from your WordPress dashboard. Then, click on the ‘Save Changes’ button without changing the permalink structure settings.
WordPress will now try to generate the .htaccess file for you.
In some cases, WordPress may not be able to generate the .htaccess file due to a file permissions issue. If that’s the case, it will show you a message at the bottom of the Settings » Permalinks page saying that the ‘.htaccess file is not writeable’.
You must manually create a new .htaccess file and add the following code snippet inside it:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /mysite/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
Simply copy and paste this code into a text editor like Notepad. After that, you need to save it as a .htaccess file on your desktop.
Now, connect to your website using an FTP client and upload the .htaccess file from your desktop.
If you get an error while uploading the file, then you need to change the file permission for your root directory.
Let’s suppose all your WordPress files are under /home/johnsmith/public_html/. This makes the public_html folder your root directory. You need to go to its parent directory and right-click on the public_html folder.
Next, select ‘File Permissions’, which will open a file permissions dialog box.
You need to enter ‘755’ into the ‘Numeric value’ box and then try to upload your .htaccess file to the public_html folder.
And that’s it! If you’re curious about .htaccess, you can learn more about it in our article on the most useful .htaccess tricks for WordPress.
Note: Once you have found your .htaccess file, then we suggest creating a backup of your WordPress site first before editing it. Incorrect edits can cause website functionality issues.
What to Do If You Cannot Create or Edit .htaccess
In some situations, you might encounter issues creating or editing the .htaccess file on your WordPress site.
For example, your web server’s configuration might restrict editing certain files, including the .htaccess file. In rare cases, a plugin might even interfere with your ability to manage the .htaccess file.
If you’ve tried the troubleshooting tips mentioned and still can’t create or edit the .htaccess file, then the best course of action is to contact your WordPress hosting provider’s support team.
You can read our guide on how to ask for WordPress support and get it for more information.
Learn More Ways to Troubleshoot WordPress
Are you experiencing other WordPress errors? Check out these guides to solve the problem:
- How to Fix the WordPress .htaccess File (Beginner’s Guide)
- How to Fix WordPress Website Not Updating Right Away
- How to Fix Featured Image Not Showing in WordPress
- How to Fix WordPress Keeps Logging Out Problem (Beginner’s Guide)
- How to Recover and Restore Deleted Pages in WordPress
- Why Can’t I Add or Install Plugins in WordPress?
- How to Fix Missing Admin Bar Issue in WordPress
- What to Do When You Are Locked Out of WordPress Admin (wp-admin)
We hope this article has helped you find the .htaccess file on your WordPress site. You may also want to see our WordPress troubleshooting guide to fix common WordPress errors and our list of the best WordPress plugins to grow your website.
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.
Jiří Vaněk
Thank you for the advice. It helped me not only solve the issue with the htaccess file, which I encountered for the first time (on other servers I saw the file without any issues), but it also helped me solve the problem with the .user.ini file, where I needed to place directives for PHP limits. I didn’t know these files are hidden by default.