Another day, another support question via the Facebook Site habschned.com. I probably should do a post about me not providing support via social media on that page and make it sticky hehe. Anyway, the guy that contacted me had some questions about the .htaccess file he deleted and how to get it back. Deleting the default .htaccess file is no biggie really unless you had hundreds of lines in it for your scripts/website.
Let me explain how to recreate the default .htaccess file and its content. All you need for doing so is a text editor (even Notepad will do) and a way of uploading the file to your 000webhost.com account. For the latter you can either use a FTP client like FileZilla or one of the File Managers 000webhost.com offers in their control panel. Honestly, i would go the FTP client way, a lot easier and more reliable than using the web based file managers.
Grab a text editor of your choice and create a new document. Paste the following lines into the document, then save it to your computer as htaccess.txt
Now fire up your FTP client (or one of the file managers in the 000webhost.com control panel) and upload the htaccess.txt file you just saved to your public_html directory. A common mistake is to upload the file outside the public_html directory and as a result of that it won’t work. So make sure you upload it in the public_html directory. In this example i now have two files in my public_html, default.php and htaccess.txt.
The final step is to rename the file from htaccess.txt to .htaccess to make it work. Again, either use one of the file managers available in the 000webhost.com control panel or a FTP client of your choice. In the file manager select the file, then click Rename and change the file name to .htaccess. When using a FTP client simply do a right-click on the file, select Rename (or whatever it might be called in your FTP client) and change the file name to .htaccess.
And that’s it. You now have the default .htaccess file back in your account. Simple enough, isn’t it?