homepage Welcome to WebmasterWorld Guest from 107.21.187.131
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Prevent certain files from being parsed as PHP
phpmaven




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

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




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

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

phpmaven




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

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

wilderness




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

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




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

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




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

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




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

Thank you so much.
That last idea works perfectly!

Mark

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved