If you’ve arrived at this post you can’t find the .htaccess file on your hosting server. There are a few reasons why you might be having difficulties. I’ll explain what they are likely to be and how to remedy them.
Before this though I’ll briefly explain what the .htacces file is and why it’s important.
What is the .htaccess File?
.htaccess is a file found on many web hosting servers. Basically speaking, it is a configuration file that instructs a webserver how to handle certain requests.
Among a great many other things, we use .htaccess to:
- Redirect visitors from one URL to another,
- Shorten URLs to make them more user friendly and memorable.
- Control access to certain areas of your blog.
An example for WordPress users. The WordPress system automatically finds and edits the .htaccess file and modifies it to convert it’s permalink structure (URLs). It does this to make long and complicated sequences shorter and more memorable. This is often thought of as making URLs more “pretty”. I discuss this further later on in this post.
.htaccess is a special type of file known as a hidden file. Many webservers run on a version of the UNIX operating system, in which hidden files are common. Any file prefixed by a “dot” before the name is automatically hidden in UNIX. In order to see them you have to configure your webserver to show you them.
You can find out lots more about .htaccess at Apache.org.
3 Reasons Why You Can’t Find the .htaccess File
So let’s get back to the reason you’re here… why you can’t find .htaccess.
1. You Don’t Know Where to Look for It
It’s possible the reason you can’t find the .htaccess file is you’re not sure where it is on your server.
In most cases .htaccess will be located in the home directory of your webserver filesystem. So if you have a WordPress blog, you would need to look for .htaccess in the main WordPress installation directory.
Most often you would need to look in the public_html/ directory of your server, assuming this is where you’ve installed WordPress. However you might need to look lower down the directory tree if you’ve installed WordPress somewhere else, such as public_html/blog for example.
If you can’t see the .htaccess file in your home directory it might be…
2. You Can’t Find .htaccess Because it’s a Hidden File!
It’s entirely possible that .htaccess is on your server but that you just can’t find it becasue it’s hidden. If this is the case you’d need configure the tool you use to look at files on your server to make hidden files visible.
If you use an FTP client to manage files on your webserver, you’ll need to configure it to show hidden files. How you do this will vary according to the FTP client but the first place to look would be in your settings.
If you use your webserver Control Panel software (such as cPanel) I describe how to reveal hidden files in detail in this post: How to Show Hidden Files in cPanel File Manager.
3. You Don’t Have a .htaccess File!
It is entirely possible that the .htaccess file does not exist in the WordPress home directory on your server. If this is the case, you’ll never find .htaccess whether it’s hidden or not! The solution then is to create one and you can do this in one of two ways.
Create .htaccess in WordPress
If you use WordPress, there is a straightforward way to configure it to generate the .htaccess file in your webserver’s home directory automatically.
You do this by visiting the Settings > Permalinks page from your WordPress Admin screen and clicking the “Save Changes” button without making any changes to the default settings.
This forces WordPress to create the .htaccess file and write a rule for your default WordPress permalink structure.
There is something to look out for. If you have a permissions issue in the home directory of your webserver, WordPress might not be able to create .htaccess for you. If this is the case, when you click the “Save Changes” button, you will see the following message: “.htaccess file is not writeable.”
If this is the case you will need to create .htaccess manually as per the outline below.
Create .htaccess Manually
The following are the steps you need to take if:
- You can’t find the .htaccess file and you know that it’s definitely not in your webserver home directory (i.e. you can see all hidden files and it’s not there).
- or WordPress cannot create your .htaccess file because of a permissions issue.
If either or both of these are true, you can manually create .htaccess on your server.
Firstly, you can use your webserver Control Panel File Manager tool, go to your home directory and use the “New File” option (or something similar depending upon your Control Panel installed) to create a file called .htaccess.
Secondly, if you use an FTP client to upload files to your server, create a blank text file on your computer called .htaccess and upload it via FTP to your home directory.
I’ve suggested 3 possible reasons why you can’t find the .htaccess file you’re looking for:
- .htaccess should be in the home directory of your hosting server and perhaps you didn’t know where to find it… but you do now!
- It’s a hidden file and so perhaps it’s already in the home directory of your server but you can’t see it. You need to configure your Control Panel File Manager or FTP client to show hidden files.
- Or you don’t actually have a .htaccess file and you need to create one. You can use the File Manager tool in your hosting server admin tools or an FTP client such as Filezilla to do this.
That’s all for now!
Thanks for visiting SideGains! If you have any questions or suggestions to improve this post, please leave me a comment below and I’ll respond asap.
<— Share this image on Pinterest