Where is my .htaccess File?

In this article I quickly show you where your account’s .htaccess file resides on the server, as well as how to edit it.

You can make similar changes in the Apache configuration file, but only with root access. That’s why the .htaccess file is very important to users on our Linux Shared Hosting accounts.

What is .htaccess?

The .htaccess file is a hidden text file that allows you to control the way visitors access your site. Some common uses of the .htaccess file would be restricting access to certain files or redirecting URLs.

You can review our full .htaccess file reference list for more examples of what you can do with a .htaccess file.

Where is my .htaccess file?

By default you should have a .htaccess file created on your account in the following directory:

/home/userna5/public_html/.htaccess

You can use your favorite FTP client to modify this file or follow the steps below to access it directly from cPanel:

  1. Login to your cPanel.
  2. Under the Files section, click on File Manager.

  3. Locate your .htaccess file, you may have to show hidden files

(click Settings–>Check the “Show Hidden Files (dotfiles)” box).

  • Right-click on the .htaccess file and select Edit.

  • If you didn’t locate your .htaccess file during the previous step, click on +File on the top-left, name the file .htaccess, and finally set the directory for the file to be created to /public_html/ or the document root of your site.
  • You might have a text editor encoding dialog box pop-up, you can simply click on Edit.

Congratulations, now you know how to locate, and edit your .htaccess file!

Did you find this guide helpful? When you’re an InMotion Web Hosting customer, you get full access to the vast library of our support documentation as well as world-class, 24/7 support.

InMotion Hosting Contributor
InMotion Hosting Contributor Content Writer

InMotion Hosting contributors are highly knowledgeable individuals who create relevant content on new trends and troubleshooting techniques to help you achieve your online goals!

More Articles by InMotion Hosting

18 thoughts on “Where is my .htaccess File?

    1. .htaccess files may be automatically created by existing applications, or by people adding code for different purposes. So, if you’re using a few plugins for your website, it is possible that code is being added to the .htaccess files. I hope that helps to provide some clarity on the issue.

      If you have any further questions or comments, please let us know.

  1. I have found several htaccess files throughout my web site. The site has gone through several formats over the past 8 years. To effectively utilize my forced https code insertion into a default htaccess file, where do I place it in the root? Directly into the /public_html/? Is it then safe to delete all of the other htaccess files I find scattered throughout the site or are those issuing directives for plugins? One of them has some Leverage Browser Caching Ninja code inserted to set peramiters for the Caching Ninja plugin. Of which I am not so sure does anything.

    1. Typically, you would put the .htaccess in the root directory of the website, but it can inherit rules from “parent” folders. It is difficult to say if you need the other .haccess files, since your website may rely on existing rules. Also, if you are using a CMS such as WordPress, Joomla, Drupal, etc. I recommend using a plugin, addon or extension instead of adding a rule directly to the .htaccess file. This is because CMS’ rely on .htaccess rules too and custom coded rules can interfere with their functionality.

      Thank you,
      John-Paul

    1. Hello Yogesh,

      Thank you for contacting us. Yes, your .htaccess rules must be translated to work with nginx.

      There are many online tools available that can help you with that, as described in this post I found online.

      Thank you,
      John-Paul

  2. You Desere a salute….I was wandering since last 3 days…and you did the miracle by simpliying this.

     

    Thanks

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+