The .htaccess file is a configuration file, specifically used by Apache based web servers, to help manage certain functionality associated with files/folders directly tied to your website.
Short for Hypertext Access, when a .htaccess file is present in a directory Apache will load this file and any applicable rules that are defined in the file. A good example of a rule addition that would be placed in your .htaccess file would be a 301 redirect.
This behavior allows .htaccess files to modify the way Apache operates on a per directory basis by enabling or disabling functionality/features as defined in the .htaccess file. Since the .htaccess file is a ‘dot file’, it is hidden by default.
It is also important to note that the location of this file is very important, as it not only affects the main directory that it is in. but also all sub directories in a recursive manner.
How To Make Sure An .htaccess File is Active
By default Hostwind’s Shared, Business, Reseller, and White Label Reseller hosting accounts allow for the use of .htaccess files. Rules applied through this file are specific to the site you create it for and cannot override any root level web server rules in shared hosting.
If you’re on a Cloud VPS or Dedicated Server you should have full access to modify any setting that is available via a .htaccess file. To ensure that you can utilize a .htaccess file on a Cloud or dedicated server you’ll need to edit the Apache configuration file and change the option AllowOverride from None to All. It should look similar to the following example:
Options Indexes FollowSymLinks MultiViews
allow from all
Once you have made this change you’ll then need to restart Apache, how this is done will depend on your Linux distro. There are many different directives that you can utilize with an .htaccess file.
If you’d like to learn how to create a .htaccess file or you’re curious how to edit an already existing .htaccess file, please review the following article, Creating and editing an .htaccess file.
- Set a temporary (302) redirect
- Define a different index file
- Redirect to use the SSL connection (https)
- Set a permanent (301) redirect
- Password protect files or directories
- Force browser to download media files
As always, if you have any further questions or need for assistance , please feel free to contact our 24/7 Live Chat and we’ll be happy to help you.