Are you having trouble finding the .htaccess file in WordPress? We are often asked by beginners ‘Where is my .htaccess file?’ and ‘Why I cannot find it on my WordPress site?’.
Sometimes you may need to edit the .htaccess file or delete it to fix a common WordPress errors. In this article, we will explain why you can’t find .htaccess file on your WordPress site, and how to easily locate it.
What is .htaccess file?
The .htaccess file is a server configuration file which tells your server how to handle certain things on your website. Like how to redirect users, password protect admin area, or protect some directories, etc.
It is located in your WordPress site’s root folder. WordPress uses it to manage redirects and permalinks.
The .htaccess file is an incredibly powerful configuration file and can be used to do a lot useful things. See our article on the most useful .htaccess tricks for WordPress for some examples.
Why I Can’t Find .htaccess File?
There are two common reasons for not finding the .htaccess file in your website’s root folder. It’s either hidden by your file manager software, or it doesn’t exist at all.
We will explain both of them with solutions.
1. Your FTP Client 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 client settings.
For example, in FileZilla, you can find the option under ‘Server » Force showing hidden files’ menu.
If you are using the File Manager app in cPanel, then you will find the option to show hidden files before launching the app.
For other FTP clients, you will find the option to show hidden files in app settings or preferences menu.
After enabling this option, you would be able to view all hidden files including .htaccess file for your WordPress site.
2. The .htaccess File Doesn’t Exist
The second most common reason for missing .htaccess file is that your WordPress site has not generated it yet.
WordPress automatically generates .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 page and click on ‘Save Changes’ button without changing anything.
WordPress will now try to generate the .htaccess file for you.
On some rare occasion, WordPress may not be able to generate the .htaccess file due to file permissions issue.
In that case, it will show you a message at the bottom of the Settings » Permalinks page, saying that the ‘.htaccess file is not writeable’.
You will need need to manually create the .htaccess file and add the required code inside it.
Simply copy and paste this code in a text editor like Notepad. After that, you need to save it as .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 reside under
public_html folder your root directory. You need to go to its parent directory and right click on the
public_html folder. Select File Permissions, which will open a file permissions dialog box.
Now enter 755 into the file permission dialog box and then try to upload your .htaccess file to the public_html folder.
We hope this article helped you find .htaccess file on your WordPress site. You may also want to see our WordPress troubleshooting guide to learn how to diagnose and fix WordPress issues all by yourself.
The post Why You Can’t Find .htaccess File on Your WordPress Site appeared first on WPBeginner.WordPress Maintenance