Every WordPress file is important to run your website properly. The .htaccess (hypertext access) is one of the important files in WordPress core files which will completely change the way your website interact with its server.
Many WordPress users who are hosting their own blog are still unaware of the .htaccess file in WordPress. In this article, I’ll talk about what is .htaccess file and how to find and create the .htaccess file in WordPress.
What is .htaccess in WordPress?
The .htaccess file is a configuration file that gives instructions to your website server on how to handle your website content.
You can override many server configuration settings and enable/disable the new functionality and features through a .htaccess file in WordPress.
What we can do with .htaccess?
- Rewrite the URL’s and make them SEO friendly.
- Redirect visitors from old URL’s to new URL’s.
- Protect your website directories with a password.
- Create a custom 404 pages to show a friendly error page for your website visitors.
- Add a custom maintenance page.
- Improve caching for better speed.
- Allow or deny visitors by IP address.
- Stop image Hotlinking.
Where we can found .htaccess file?
The .htaccess file is not only associated with WordPress but you can also found on any Apache web hosting servers. The .htaccess file usually found in WordPress root folder after installing WordPress on your web hosting server. In some cases, by default .htaccess file stays in hidden mode and your Cpanel or FTP client unable to show your file. To see these files you need to enable show hidden files option in your Cpanel or FTP client.
Let’s check, how to view a .htaccess file.
Step 1: Login into your web hosting Cpanel and click on file manager under the files section. In file manager directory selection, click on show hidden files option and click on go to open root folders.
Step 2: You’ll find your .htaccess file on your WordPress root folder that is public_html folder. Open the public_html folder and locate your file.
Click on view to see the file or edit to edit the file.
You can also download the file on to your computer and make changes and upload the file again to your web hosting server to initiate the changes.
In case .htaccess file not exist on your root folder, you can simply create one.
How to create WordPress .htaccess file?
Create a text file on your computer and name it .htaccess. Your file name will be .htaccess.txt. Simply upload the .htaccess.txt file to your public_html folder and click on rename option and remove .txt from the file name. Make sure file name should not be .htaccess.txt in anyways.
Default permissions for the security of .htaccess file are 644. If you want to change any permalinks settings from your WordPress dashboard and WordPress unable to access your .htaccess file, then you need to change permissions to 777. After changing the settings, make sure to change its permissions to 644 to avoid security issues.
I hope this article helped you to know more about the .htaccess file and how to find and create the .htaccess file in WordPress.
Please share this article with your friends on Facebook, Google + and Twitter which will help the users who are facing the same issue.