Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added .htaccess to doc/misc.md #1557

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions doc/misc.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ table of contents](TOC.md)

* [.gitignore](#gitignore)
* [crossdomain.xml](#crossdomainxml)
* [.htaccess](#htaccess)

--

Expand Down Expand Up @@ -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 <Directory> 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)