Forum Moderators: phranque

Message Too Old, No Replies

Prevent certain files from being parsed as PHP

         

phpmaven

4:17 pm on Mar 3, 2012 (gmt 0)

10+ Year Member



I'm running Apache 2.2.3
I'm loading PHP as a module.
I have the following directive in my httpd.conf file:
AddType application/x-httpd-php .php .htm .html .css

I have a specific directory where i do not want to parse css files as PHP

I've tried all of the combinations of RemoveType and RemoveHandler in .htaccess in that directory and I cannot get it to work.
.htaccess is definitely being read as if I put other directives in there, they work.

I'm stumped.

I would appreciate some help.

Thanks

wilderness

4:35 pm on Mar 3, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



see this recent and very similar inquiry by myself [webmasterworld.com]

phpmaven

4:39 pm on Mar 3, 2012 (gmt 0)

10+ Year Member



Thanks wilderness, it doesn't seem to address my situation, unless I missed it, but I appreciate the link.

wilderness

4:49 pm on Mar 3, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have a specific directory where i do not want to parse css files as PHP


are the css file within that specific directory or a parent directory?

do you have an htaccess specific to that specific directory?

phpmaven

4:56 pm on Mar 3, 2012 (gmt 0)

10+ Year Member



I have the following basic stucture:
/htdocs
/htdocs/blog
/htdocs/blog/wp-content
etc..

I don't want css files parsed in /htdocs/blog or any of it's subdirectories

I have the .htaccess file in /htdocs/blog
My understanding is that the directives would apply to all the subdirectories of /htdocs/blog

SteveWh

6:17 pm on Mar 3, 2012 (gmt 0)

10+ Year Member



Maybe put a different AddType command in the local .htaccess to override the global one? First try might be

AddType text/css .css

This page has an example showing the use of AddType in httpd.conf in a <Directory> section, so it applies only to the named directory:

[httpd.apache.org...]

So what you want might be something like this:

AddType application/x-httpd-php .php .htm .html .css
<Directory /htdocs/blog>
AddType text/css .css
</Directory>

phpmaven

9:06 pm on Mar 3, 2012 (gmt 0)

10+ Year Member



Thank you so much.
That last idea works perfectly!

Mark