This is a common question among beginners. For some reason, they cannot find their .htaccess file.
With this knowledgebase, we will understand “Why is your .htaccess file not showing up and what steps must you take?
You can find the .htaccess file in the Root folder of the following 3 platforms:
- In cPanel
- In FileZilla FTP, and
- On the WordPress website.
What is a .htaccess File?
It is important to understand that .htaccess is a powerful web-based file that controls a website’s high-level configuration and operation. With its help, you can modify the settings of your website without editing the server configuration files. Your .htaccess file is present in the Root folder of your website.
Now that we have accepted that .htaccess is an important file, it is more than necessary to understand how to find the htaccess file.
Before going to a way of finding an htaccess file, It is important to know the reason for not showing a file.
Also Read: How to Take Backup of Emails from cPanel
Why is Your htaccess File Not Showing?
It is important to understand that .htaccess is a powerful web-based file that controls a website’s high-level configuration and operation. With its help, you can modify the settings of your website without editing the server configuration files. Your .htaccess file is present in the Root folder of your website.
Now that we have accepted that .htaccess is an important file, it is more than necessary to understand how to find the htaccess file.
Predominantly, there are only 2 reasons that limit you from finding the .htaccess file.
- Either your File Manager (software) has hidden the file
OR - The file does not exist at all.
Note: The dot before the htaccess file indicates that this file type is a hidden one by default.
Also Read: How to Create a PHPinfo File and View PHP Information?
Why is Your htaccess file not showing in cPanel? – How to Show Hidden File?
If the cPanel’s File Manager does not display automatically, you must not consider that your htaccess is missing from the cPanel. The .htaccess file stays hidden by default.
You must follow the steps below to unhide your .htaccess file.
- Sign in to your cPanel account.
- To access the files, open File Manager.
- Locate the Settings button present in the top-right area of the File Manager.
- Visit the Preferences window. Click to select the option “Show Hidden Files (dotfiles).”
- Click on the Save button to make your changes effective.
You can now see all the hidden files (including .htaccess files) in your cPanel’s File Manager.
Why is your htaccess file not showing in Filezilla FTP?
Here are the simple steps you must follow to see your .htaccess file in Filezilla FTP:
- Open your Filezilla Interface.
- Locate the Server in the Menu Bar.
- Clicking on the Server tab will open a drop-down list.
- Click the last option, “Force showing hidden files.”
- This will open a dialog box. Click OK.
Now, you can see the hidden files in the Filezilla FTP interface.
Also Read: How do I Redirect my site using a (dot) htaccess file?
How do I see my .htaccess file on the WordPress website?
In standard cases, WordPress automatically generates a .htaccesss file to redirect permalinks properly. But your WordPress might be missing the .htaccess file.
Here are a few simple steps to generate your .htaccess file on the WordPress website:
- Go to your WordPress Dashboard.
- Click on Settings and expand the menu
- Click on Permalinks (the 6th sub-menu under Settings.)
- Click on Save Changes without making any modifications.
Now your WordPress will attempt to generate the .htaccess file.
Also Read: How to Upload HTML files to Your WordPress Website?
Insufficient Permissions:
Insufficient file permissions will not allow WordPress to generate the file.
The Settings >> Permalinks page will display the “.htaccess file is not writeable” message at its bottom.
Manual Creation of .htaccess file
You are left with the only option to create the .htaccess file manually.
Use a text editor like Notepad or Notepad++ to create the file. Copy and paste the following code into the file and save it with the file name “.htaccess” to your desktop.
Code:
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Connect to your server using your FTP.
Use your FTP credentials to connect to your server. Go to the parent directory of your root WordPress directory. You will find all WordPress installation files in this folder. Right-clicking on the folder will open a small menu. Go to the “File Attributes…” at the bottom of the menu. Manually type in 755 in the Numeric Value field and click OK.
Confirm the permissions for the directory “public_html”
Ensure that these permissions are correctly defined.
Permissions |
Read | Write | Execute |
Owner | Yes | Yes | Yes |
Group | Yes | No | Yes |
Public | Yes | No | Yes |
Now click on the “OK” button.
Go to your Root WordPress directory. From your desktop, drag the recently created .htaccess file and upload it to this directory.
Also Read: Ultimate Guide to Fix Internal Server Error in WordPress
Important Note on Recommended Permissions
Set Permissions For | Set Value As |
Folders and Directories | 755 OR 750 |
Files | 644 OR 640 |
wp-config.php | 440 OR 400 |
Once your .htaccess issue gets resolved, you need to ensure that values for the Recommended Permissions are set as per the above table.
This will ensure your website’s safety and smooth functioning.
Also Read: How to upload Laravel Project on Shared Hosting With cPanel?
Conclusion
The information presented above will help you understand why you cannot find your .htaccess file and how you can discover it. You would also have learned by now to create a new .htaccess file manually.
We would love to hear from you. Host IT Smart welcomes queries for domains, web hosting, SSL certificates, and allied products. You may drop a line at info@hostitsmart.com, and one of our experts will be happy to help you.
XXXXXXX