How to Create a .htaccess file

htaccess Tutorial – How to Create a .htaccess file

htaccess-tutorial-how-to-create-a-htaccess-file

How to create a htaccess fileThe purpose of this .htaccess tutorial is to learn how to create a .htaccess file and to give you a better understanding of its capabilities and functions. In this tutorial, we will cover how to create a .htaccess file from scratch and upload it on your server via FTP. The whole process is very easy to do and only takes about ten minutes or less, depending on your knowledge and skill set.

– Let’s take a moment and look at some of the things we can do with the .htaccess file – –

* Prevention of hot-linking images. This is where someone links to an image from your site. This saves them bandwidth, but costs are passed on to you if you are paying for bandwidth.

* Blocking bad bots.

* Password protect website directories.

* Prevent people from browsing through a particular folder.

* Prevent viewing of the .htaccess file.

* Change the default index page of your site or a folder.

* Redirect visitors automatically from one page to another or to another website.

* Ban users by their IP address

* The use of custom 404 error pages

The .htaccess file is a text file, consisting of an eight letter file extension without a file name. It contains Apache directives which allow you to make very important configuration changes on Linux and Unix servers running the Apache Web Server on a per-directory basis. Once the .htaccess file is placed in a particular directory, those directives will apply to the documents in the directory and all sub-directories as well.

Creating a .htaccess file the easy way, simply follow these steps

* Open your Windows notepad editor.

Browse your folders and select which folder you want to save the .htaccess file in, then click Save

The next step is to verify that the file was named .htaccess by the editor. You simply open the Windows file manager, locate the file, right-click the file icon and selecting Properties.) If the file was named with the .txt suffix, you can rename the file to .htaccess and your done with the verification process.

You now need to upload the .htaccess file into your site in ASCII mode.

Setting up a FTP connection to your website

To set up a FTP connection you will need to use what is known as a FTP client. Two good examples of FTP clients are http://www.cuteftp.com (paid) and http://filezilla-project.org (free)

After you are done installing a FTP client, it’s time you set up a connection using it. When you signed up with your webhost you should have received details like an FTP Address, a username and a password from them. Your webhost may have provided you with more details like the URL to access your Control Panel software. I’ll cover more on this in a different section of the guide.

To set up the connection, launch the FTP application that you had installed and find the option that lets you create a new connection. You will now see a window in which you need to specify the details that are required to set up a connection. These details include assigning a name to your connection, specifying the FTP or Host Address and entering the username and password.

Your client might also ask you which protocol you want to use, in most cases the answer would be FTP which is the standard protocol for transferring files over a network. If it asks what transfer type you want to use, select Auto Detect. You are done setting up the connection, and you can now try connecting to your site for the first time. If you have followed everything correctly, you should be successfully connected to your host.

You may need to CHMOD the .htaccess file to 644, which makes the file usable by the server.

Additional Notes

* If you are hosting on a Windows-based server, you cannot use the .htaccess file.

* If you WordPress is installed in the root, then you need to upload the .htaccess file to the root. If your WordPress is installed in a sub folder like “blog”, you will need to upload it into the appropriate folder.

Hope this blog post was helpful to you, “.htaccess Tutorial – How to Create a .htaccess file” Be sure to share this post with your friends on Twitter. Furthermore, I appreciate your time that you have spent here!

Leave a Reply

Your email address will not be published. Required fields are marked *