# HttpAdditionModule not working for subdirectories

**URL:** <https://www.ruby-forum.com/t/httpadditionmodule-not-working-for-subdirectories/218091>\
**Category:** NGINX\
**Created:** [March 21, 2012, 2:08am UTC](https://www.ruby-forum.com/t/httpadditionmodule-not-working-for-subdirectories/218091 "2012-03-21T02:08:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [March 21, 2012, 2:08am UTC](https://www.ruby-forum.com/t/httpadditionmodule-not-working-for-subdirectories/218091/1 "2012-03-21T02:08:31Z")

</div>

Hy everyone!

It turns out that HttpAdditionModule is only working for the PHP files  
stored into the web root dir. All content from, let’s say, “/forum”  
won’t display the embedded content.

Error log pointed out that Nginx is including the subdirectory into the  
HttpAdditionModule URI, so “/header/global.php” mistakenly becomes  
“/forum/header/global.php”. Needless to say, that file doesn’t exist.

Given that variables are not supported in this module, how can I fix  
that?

Thank you so much!

Base system: Nginx 1.0.14 with PHP5-FPM  
Settings:

```
    location ~ \.php$ {
    root /var/www;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME

```

$document\_root$fastcgi\_script\_name;  
include fastcgi\_params;  
add\_before\_body /header/global.php;  
}

Posted at Nginx Forum:

> **[HttpAdditionModule not working for subdirectories](https://forum.nginx.org/read.php?2,224124,224124#msg-224124)**
>
> Hy everyone! It turns out that HttpAdditionModule is only working for the PHP files stored into the web root dir. All content from, let's say, "/forum" won't display the embedded content. Error log pointed out that Nginx is including the...

---

<div class="post-metadata">

**Author:** ![Smeagle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bcef8e/32.png) [@Smeagle](https://www.ruby-forum.com/u/Smeagle)\
**Post date:** [March 21, 2012, 5:59pm UTC](https://www.ruby-forum.com/t/httpadditionmodule-not-working-for-subdirectories/218091/2 "2012-03-21T17:59:16Z")

</div>

Hello!

On Tue, Mar 20, 2012 at 09:07:41PM -0400, Smeagle wrote:

> Hy everyone!
> 
> It turns out that HttpAdditionModule is only working for the PHP files  
> stored into the web root dir. All content from, let’s say, “/forum”  
> won’t display the embedded content.
> 
> Error log pointed out that Nginx is including the subdirectory into the  
> HttpAdditionModule URI, so “/header/global.php” mistakenly becomes  
> “/forum/header/global.php”. Needless to say, that file doesn’t exist.

No it doesn’t.

Note though, that uri specified in add\_before\_body is subject  
normal processing, and if there are rewrites or something like in  
your config - you may end up with completely different uri.

> ```
> root /var/www;
> fastcgi_pass 127.0.0.1:9000;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME
> 
> ```
> 
> $document\_root$fastcgi\_script\_name;  
> include fastcgi\_params;  
> add\_before\_body /header/global.php;

Please show full config which triggers the problem for you. I  
suppose there are rewrites which change /header/global.php to  
/forum/header/global.php.

Maxim D.
