server confi ht access

Last Updated On Friday 22nd Apr 2022

Server Configuration

H5BP includes a .htaccess file for the Apache HTTP
server
If you are not using Apache
as your web server.

A .htaccess (hypertext access) file is an 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.
  • For example, a <Directory> section in the main configuration file.
  • This is usually the recommended way, as using .htaccess files slows down Apache!

The .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 beginning 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 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 the .htaccess file check out the
Apache HTTP server docs or more
specifically the ht access section