---
title: "Passenger applications do not inherit htaccess rules"
date: "2016-02-17"
category: "cgi-passenger"
slug: "passenger-applications-do-not-inherit-htaccess-rules"
---

## Overview

[[htaccess-guide]] files override global server configuration for your applications. However, [[passenger-supported-apps]] (Node, Python, and Ruby) do not inherit `.htaccess` rules from directories above the [[where-is-site-content-served-from]], which is typically the `public/` folder as described in [[passenger-application-layout]].

## Cause

When Apache detects that a document root belongs to a Passenger application, Passenger immediately takes control of request handling. Any `.htaccess` directives placed in the [[where-is-site-content-served-from]] are applied, but directives in parent directories above `public/` are not inherited.

Technically, this occurs because Passenger's `passenger_register_hooks()` in [Hooks.cpp](https://github.com/phusion/passenger/blob/stable-5.0/src/apache2_module/Hooks.cpp) blocks [mod\_dir](https://httpd.apache.org/docs/2.4/mod/mod_dir.html) via `startBlockingModDir()`, which prevents index negotiation and `.htaccess` inheritance.

## Solution

Place all `.htaccess` directives directly in the [[where-is-site-content-served-from]] of your Passenger application. There is no workaround for recursive rule inheritance with Passenger.
