Cookies ahead

Our support chat tool "Intercom" would like to collect some more data on you. See the related link for more details.

Docs

.htaccess troubleshooting

Reviewedbyfl

Markdown ↓

Debug .htaccess config problems.

When `.htaccess` rules don't take effect or the App throws a 500 error, here is how to track down common Apache config mistakes on fortrabbit.

Missing .htaccess

A common mistake is to miss the .htaccess file altogether. The dot at the beginning of the file name indicates that this file should be invisible in your operating system. When dragging files in an FTP client from the Downloads folder, the .htaccess file is likely overlooked. This can cause 403 errors.

In macOS Finder you can toggle invisible files with CMD + SHIFT + ., easy to remember, like dot files. SFTP clients with a split view option are mostly showing those files by default. Take care, there are possibly other hidden files in your project, like .gitignore and .env. See .htaccess basics for an overview.

Changes are not applied

Changes to .htaccess rules may be cached by the web browser, so it can take time before changes take effect. Try curl to test new rules without browser caching, or use another browser or incognito mode.

Wrong location

The .htaccess file is usually placed in the root path of the website, which is the htdocs folder by default. However, certain modern frameworks and CMS have paths below that — for example, Laravel uses public. Ensure the .htaccess file is in the correct directory. You can place .htaccess files in subdirectories as well; they will have higher specificity and can override parent rules. See .htaccess tips for best practices.

Possible performance issues

The fortrabbit hosting platform is managed. Therefore your access to critical services is limited. This is actually good for most parts. We believe in a clear separation of concerns: We run the servers, you do the coding. One consequence is that we can not give you direct access on the Apache web server configuration (httpd.conf).

The .htaccess file is a very common method to achieve common web server configurations. In fact, almost every framework and CMS comes with a .htaccess out of the box. .htaccess lives in your code base and is deployed along with Git and therefore it's just very convenient to use.

Consider it a workaround that got too popular. The official Apache docs have a whole section on "When NOT to use .htaccess". The NGNIX team has setup a marketing page bad-mouthing .htaccess for a bad design, performance-wise.

In practice, we prefer clean, fast implementations. But sometimes trade-offs are necessary. .htaccess offers convenience and security through separation of concerns.

In our experience, any potential performance impact is imperceptible.

Written by a human. Review, grammar checks and typo fixes by AI.

AI use & editorial processEdit on GitHub ↗