Here are the most common mistakes we see in combination with `.htaccess`.
Another common mistake we see quite often is to miss out the
.htaccess file. The dot at the beginning of the file name indicates that this file should be invisible in your operating system. So when you dragged files in your FTP client from the Downloads folder, it's very likely that the
.htaccess file was left home. 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
Changes are not applied
.htaccess contents are cached (web browser), so it might take a while until you see changes you have made to
.htaccess files to be applied. You can try
curl to test the new rules or you can try another browser or incognito mode.
.htaccess file is usually placed in the root path of the website. Per default, that is the
htdocs folder. But certain modern frameworks and CMS have path below that, like Laravel with
public. So make sure to place your
.htaccess in the correct directory. You can place the
.htaccess files in folders below the root path as well, those will have a higher specificity and can override rules.
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).
.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.
Now, usually we prefer clean, smooth and fast implementations. But sometimes one have need to make trade-offs.
.htaccess brings convenience and security (separation of concerns).
In our experience, the possible performance degradation can not be experienced.