From bc702c071056e9e7edc85c78e9b90cd92262717c Mon Sep 17 00:00:00 2001 From: Arthur Verschaeve Date: Thu, 10 Jul 2014 11:59:09 +0200 Subject: [PATCH] Added .htaccess to doc/misc.md --- doc/misc.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/doc/misc.md b/doc/misc.md index f1e95cbc75..0af1f3f071 100644 --- a/doc/misc.md +++ b/doc/misc.md @@ -5,6 +5,7 @@ table of contents](TOC.md) * [.gitignore](#gitignore) * [crossdomain.xml](#crossdomainxml) +* [.htaccess](#htaccess) -- @@ -48,3 +49,39 @@ to the source domain and allow the client to continue with the transaction. For more in-depth information, please see Adobe's [cross-domain policy file specification](http://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html). + +### `.htaccess` + +A `.htaccess` (hypertext access) file is a Apache HTTP server configuration file. The `.htaccess` file is mostly used for: + +* Rewriting URLs +* Controlling cache +* Authentication +* Server-side includes +* Redirects +* Gzipping + +If you have access to the main server configuration file (usually called `httpd.conf`), you should add the logic from the .htaccess file in, for example, a section in the main configuration file. This is usually the recommended way, as using .htaccess files slows down Apache! + +To enable Apache modules locally: https://github.com/h5bp/server-configs-apache/wiki/How-to-enable-Apache-modules + +In the repo `.htaccess` is used for: + +* Allowing cross-origin access to web fonts +* CORS header for images when browsers request it +* Enable `404.html` as 404 error document +* Making the website experience better for IE users better +* Media UTF-8 as character encoding for `text/html` and `text/plain` +* Enabling the rewrite URLs engine +* Forcing or removing the `www.` at the begin of a URL +* It blocks access to directories without a default document +* It blocks access to files that can expose sensitive information. +* It reduces MIME type security risks +* It forces compressing (gzipping) +* It tells tell the browser whether they should request a specific file from the server or whether they should grab it from the browser's cache + +When using `.htaccess` we recommend reading all inline comments (The rules after a `#`) in the file once. There is a bunch of optional stuff in it. + +If you want to know more about `.htaccess` check out http://httpd.apache.org/docs/current/howto/htaccess.html + +Notice that the original repo for the `.htaccess` file is [this one](https://github.com/h5bp/server-configs-apache/blob/master/src/.htaccess)