Why You Can’t Find .htaccess File on Your WordPress Site
Sometimes you may need to edit the .htaccess file or delete it to fix common WordPress errors.
What is a .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 of 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.
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 a .htaccess file for your WordPress site.
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 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 the 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 a 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 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 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 reside under /home/johnsmith/public_html/ directory.
This makes 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.