# Global htaccess

DevFeed: [Global htaccess](<https://devfeed.tech/articles/global-htaccess-25391.md>)

Original publisher: [Read original article](<https://smileykeith.com/2013/08/14/global-htaccess/>)

Author: Keith Smiley

Published: 2013-08-14T20:12:00Z

Content type: article

Language: en

Sources: [Keith Smiley](<https://devfeed.tech/sources/keith-smiley.md>)

Topics: [configuration](<https://devfeed.tech/topics/configuration.md>), [Boilerplate](<https://devfeed.tech/topics/boilerplate.md>), [HTML5](<https://devfeed.tech/topics/html5.md>), [Linode](<https://devfeed.tech/topics/linode.md>), [Ubuntu](<https://devfeed.tech/topics/ubuntu.md>), [Server](<https://devfeed.tech/topics/server.md>), [Web Development](<https://devfeed.tech/topics/web-development.md>)

Tags: [article](<https://devfeed.tech/tags/article.md>), [config](<https://devfeed.tech/tags/config.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [html5](<https://devfeed.tech/tags/html5.md>), [linode](<https://devfeed.tech/tags/linode.md>), [performance](<https://devfeed.tech/tags/performance.md>), [server](<https://devfeed.tech/tags/server.md>), [ubuntu](<https://devfeed.tech/tags/ubuntu.md>)

## AI overview

This article explains how to move Apache configuration from per-site .htaccess files into a global server configuration. It describes using a Directory block and a conf.d file on an Ubuntu 10.04 Linode VPS to improve performance and reduce site-specific configuration.

## Source excerpt

When starting a new web project one of the first things I do is download the most up to date HTML5 Boilerplate. It provides a great starting point for the HTML you need in a project. It also comes with an extremely complete .htaccess file. While this is very nice for a single site they recommend you do something different for multiple sites at the very top. (!) Using .htaccess files slows down Apache, therefore, if you have access to the main server config file (usually called httpd.conf), you should add this logic there: http://httpd.apache.org/docs/current/howto/htaccess.html. This got me to their awesome collection of server configs which has their, and in many ways the communities, recommended settings depending on your webserver. The apache configs have the same .htaccess file so I decided to dig into how to do this. They direct you to the apache article about using .htaccess files which has a similar comment about their use. You should avoid using .htaccess files completely if you have access to httpd main server config file Using .htaccess files slows down your Apache http server. Any directive that you can include in a .htaccess file is better set in a Directory block, as it will have the same effect with better performance. So I decided to set this up on my Linode VPS which is running Ubuntu 10.04. As stated in the original file comment they recommend using the httpd.conf file for your custom configuration like this. But apparently that file could be overwritten on updates of Apache which would be pretty annoying. Luckily the default Apache config file (apache2.conf on 10.04) includes the contents of the conf.d folder which is in the same location. By creating a foo.conf file in that directory Apache should immediately load its contents. As mentioned in the comment from the Apache site the custom configuration needs to be wrapped in a Directory block. The block expects you to provide a path to the files you want to be affected by the contained configuration