1. Home
  2. Web Content
  3. Sharing .htaccess rules

Sharing .htaccess rules

Contents

Overview

An .htaccess file may be shared across multiple domains and subdomains by being located in a common parent directory. Locating an .htaccess under /var/www will allow any domain or subdomain located under /var/www to inherit these rules; effectively any domain or subdomain that is not managed by a secondary user within that user’s respective home directory.

For example, assume the following layout:

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

In this situation, to have a common .htaccess shared among these 3 hostnames, locate the .htaccess file in /var/www/example.

Updated on July 8, 2019

Was this article helpful?

Related Articles