.htaccess file is also known as hypertext access file. It is just a configuration of the web server. You can use this file to control your site. This file is useful for many tasks. A few examples are
- You can redirect your site to some other site using the .htaccess file.
- If you need to change the permalink structure for your WordPress Blog, you need to make the .htaccess file writable.
- You can create customized 404 error pages for your Blog using the .htaccess file
- You can control who views your site. You might be receiving many spam e-mails from various sources. You can either block these sources or you can also set a password for viewing your site using the .htpasswd file.
- You can reduce the bandwidth usage of your site and make it load faster using the .htaccess file.
The .htaccess file is usually hidden in many of the servers. So if you don’t know whether your server has the file or not, read the following points:
View Hidden Files in FileZilla
- Open FileZilla and connect to your site.
- Click on server–>Force showing hidden files.
After doing this, you will be able to view all the hidden files in your server. The .htaccess file resides in the root directory of your server where you can find the wp-admin, wp-content and wp-includes directories. Right click on the .htaccess file and change the numeric value to 666. This makes your file writable.
How To Create .htaccess file
This tutorial will tell you how to create a .htaccess file for your blog. It is very easy. You do not need any technical knowledge to create this file. Thanks to the .htaccess file generator.
You see a form asking for so many details. But don’t worry, I will tell you a few necessary options that need to be filled up according to your requirements.
Authentication: Control Who Vies Your Site
This will provide you with options needed for you to control who views your site.
File Cache Control
This lets you enable cache control and specify cache time.
Custom Error Documents
As already mentioned, .htaccess file can be used to create customized error pages for your site. With this yo can set the custom error page to appear when there is an error.
This is used to redirect your site to a new domain. You can specify the url to which it should be redirected.
Your Generated Code
After doing all this click on “generate .htaccess files”. The mydomain.com is the url of your new site where you want to redirect. You get your .htaccess file code. Just copy this code and paste it in a text file. Upload this file on your server’s root directory.
Isn’t it easy and simple? If you have any queries please comment below 🙂