Can I use .htaccess files to customise the web server configuration?

Yes, that's perfectly fine.

The Apache web server uses .htaccess files to extend the default web server configuration.

Settings in a .htaccess file are applied to inbound web requests before they are processed by your website or web application. Common uses of .htaccess configuration settings include:

  • creating password-protected directories
  • controlling access to web sites and web applications based on the originating IP address
  • specifying custom error pages based on the returned HTTP status code
  • rewriting URLs, allowing you to present friendly URLs to people and data-centric URLs to your web site
  • setting file-level HTTP response headers for HTTP cache management

The Wikipedia .httaccess article provides a good overview on the origins and uses of .htaccess files.

The Apache web server documentation for .htaccess files provides a thorough technical guide.