---
title: "Sharing .htaccess rules"
date: "2017-02-13"
category: "web-content"
slug: "sharing-htaccess-rules"
---

## Overview

An [[htaccess-guide]] file can be shared across multiple domains and subdomains by placing it in a common parent directory. An `.htaccess` file in `/var/www` applies its rules to every domain and subdomain located under `/var/www` -- effectively any domain not managed by a secondary user within their own [[home-directory-location]].

## Example

Given this layout:

- `example.com` -> `/var/www/example/example.com`
- `sub.example.com` -> `/var/www/example/sub`
- `blog.example.com` -> `/var/www/example/blog`

To share a common `.htaccess` across all three hostnames, place the file in `/var/www/example`.
