# Error when creating .htaccess and robots.txt in root directory

**URL:** <https://forum.infinityfree.com/t/error-when-creating-htaccess-and-robots-txt-in-root-directory/102205>\
**Category:** Hosting Support\
**Created:** [November 27, 2024, 11:20am UTC](https://forum.infinityfree.com/t/error-when-creating-htaccess-and-robots-txt-in-root-directory/102205 "2024-11-27T11:20:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![opportunist](https://forum.infinityfree.com/letter_avatar/opportunist/32/6_449c533f586939b6e5f246632a46421f.png) [@opportunist](https://forum.infinityfree.com/u/opportunist)\
**Post date:** [November 27, 2024, 11:20am UTC](https://forum.infinityfree.com/t/error-when-creating-htaccess-and-robots-txt-in-root-directory/102205/1 "2024-11-27T11:20:05Z")

</div>

Whenever i am trying to create htaccess in the root directory it is showing an error, i have deleted every automatically generated files such as index2, htaccess and some bunch of other files, public files are kept in htdocs folder.

### Error:

Error during FTP download, file not found: “/.htaccess”.

…  
I tried to upload htaccess using [filezilla](https://filezilla-project.org/download.php?type=client) but after uploading it still get vanished

---

<div class="post-metadata">

**Author:** ![KangJL](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/kangjl/32/12130_2.png) [@KangJL](https://forum.infinityfree.com/u/KangJL)\
**Post date:** [November 27, 2024, 11:38am UTC](https://forum.infinityfree.com/t/error-when-creating-htaccess-and-robots-txt-in-root-directory/102205/2 "2024-11-27T11:38:13Z")

</div>

Read this?

> [@Why are my files deleted after uploading them](https://forum.infinityfree.com/t/why-are-my-files-deleted-after-uploading-them/49310/1):
>
> Sometimes, when you upload a file, the upload is completed but the file is deleted immediately afterwards. This is usually caused by one of the following issues: The file is not in a htdocs folder All websites files must be uploaded to either the main htdocs folder, or to the domain specific htdocs folder (like example.com/htdocs). You cannot upload files to other directories on your account. If you try to create or upload files anywhere else, they will be deleted automatically. The file type…

---

<div class="post-metadata">

**Author:** ![Admin](https://forum.infinityfree.com/user_avatar/forum.infinityfree.com/admin/32/36437_2.png) [@Admin](https://forum.infinityfree.com/u/Admin)\
**Post date:** [November 27, 2024, 12:26pm UTC](https://forum.infinityfree.com/t/error-when-creating-htaccess-and-robots-txt-in-root-directory/102205/3 "2024-11-27T12:26:42Z")

</div>

> [@opportunist](#):
>
> Whenever i am trying to create htaccess in the root directory it is showing an error

That’s because you can’t create a .htaccess file in the root directory. If you want to configure .htaccess rules for your website, simply create a .htaccess file in the htdocs directory of the website you want to set the rules for.

---

<div class="post-metadata">

**Author:** ![system](https://infinityfree-forum-uploads.s3.dualstack.eu-central-1.amazonaws.com/original/3X/b/0/b024fd3fa88bae093c9576e55c2c94e33f890206.svg) [@system](https://forum.infinityfree.com/u/system)\
**Post date:** [December 4, 2024, 12:27pm UTC](https://forum.infinityfree.com/t/error-when-creating-htaccess-and-robots-txt-in-root-directory/102205/4 "2024-12-04T12:27:19Z")

</div>

Closed on December 4, 2024, 12:27pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
