How to create a .htaccess File
Are you in the need for a .htaccess file, but your web hosting account is lacking one? You can create your own and upload it to the right spot after following a few simple steps.
Step 1 – Open up a plain text editor (such as Notepad) and add in the lines you need and save the file.
Step 2 – Using your FTP client you will need to upload the file to the location you need it. This is usually inside of your public_html folder.
Step 3 – Rename the file to .htaccess, and save. It should be noted that .htaccess is the file extension. It is not filename.htaccess or yourpage.htaccess, it is just named .htaccess. To protect the .htaccess file, you can add these lines to your .htaccess file:
<Files .htaccess> order allow,deny deny from all </Files>
This way, it can not be displayed when somebody types in the file path into their browser.
Step 4 – Also, in the .htaccess file, you will need to add the following line:
Replace username with your actual hosting account user name. This will tell your account where your .htaccess file exists.
Create the .htaccess file in LPCP – To create a .htaccess file in LPCP, log into the LPCP, and then go to your File Manager. Click on the text link labeled, “public_html” to navigate yourself inside the public_html folder. Now, in the empty text box to your upper-right type in .htaccess, make sure the drop down box is set to “File” and then hit the button labeled, “Create”. Your .htaccess file will be created in your public_html folder on your LPCP powered account. To edit in the File Manager, find the .htaccess and click on the green V icon on the right side of the window.
Create the .htaccess file in cPanel – To create a .htaccess file in cPanel, log into cPanel, go to your File Manager, then click on the folder icon next to “public_html” to get inside your public_html folder. Next, click “Create New File”. In the empty text box, write .htaccess, make sure it is set as a Text Document and hit the button labeled, “Create”. Your .htaccess file will be created in your public_html folder on your cPanel powered account. To edit in File Manager, click on the .htaccess and then in the top right click on the Edit File link.