.htaccess is a hidden file that usually lives in the web root folder of your code base. It enables altering the web server's configuration directives.
.htaccess rules apply to all subdirectories.
.htaccess is usually not excluded in
.gitignore so it will be deployed alongside your code. Take care: htaccess is a sharp sword. With great power comes great responsibility.
Your fortrabbit Apps are running on the Apache web server. You can make use of
.htaccess. Missing (remember it's hidden) and wrong
htaccess directives are common issues. These sensitive defaults are set on the fortrabbit platform regarding .htaccess:
- Apache configuration syntax 2.2 and 2.4 are supported
- GZIP compression is enabled per default for text based content types
- Access on all
.ht*files is disabled, so nobody can read your .htaccess
When you are using a framework or a CMS, chances are high, that you don't need to wrangle with
.htaccess at all, as that comes built-in. Here are the most used ones:
- Laravel comes with a boilerplate htaccess you can extend
- Craft CMS comes with a boilerplate htaccess you can extend
- WordPress manages htaccess for you
Browse our .htaccess section for examples on how to do redirects (https and domain), secure your WordPress, how to control HTTP headers and more.