Issue with AddHandler and file names

Posted on 2006-03-30
Last Modified: 2008-02-01
I recently installed the mod_aspdotnet on my Apache server, which required to ad the followin line to httpd.conf

AddHandler asax ascx ashx asmx aspx axd config cs csproj licx rem resources resx soap vb vbproj vsdisco webinfo

On the same server I'm also running PHP based web sites, on one of the php sites I have spme pages that names as "section_name.config.php". Problem is that Apache treat this page as an ASP.Net .config file and use the ASP.Net module to process it.

Does anyone else had a similar issue, and maybe has a solutions or workaround?


I know that if I move the AddHandler from main configuration in to a VirtualHost it would work in my scenario, but I need to figure out more stable solutions because I suspect that even on the same ASP.Net web site if I have page nameed "section_name.config.aspx", server might mistreat it as a .config (Haven't tested it though)
Question by:Sudaraka Wijesinghe
    LVL 27

    Expert Comment

    You might try the filesMatch directive

    <FilesMatch "\.(asax|ascx|ashx|asmx|aspx|axd|config|cs|csproj|licx|rem|resources|resx|soap|vb|vbproj|vsdisco|webinfo)$">
    LVL 18

    Author Comment

    by:Sudaraka Wijesinghe

    Thanks for the reply caterham_www
    but no luck, mod_aspdotnet doesn't seem to work with the method you mentioned.
    LVL 15

    Expert Comment

    Is there an AddHandler command for .php files?  What happens if you swap the order of the ASP and PHP handlers?
    LVL 18

    Author Comment

    by:Sudaraka Wijesinghe
    Nope, there's no AddHandler for .php
    LVL 10

    Accepted Solution

    There is no AddHandler for .php by default, but one can be used.  You can try replacing your AddType line:

       AddType application/x-httpd-php .php

    with (php4):

       AddHandler php-script php
       AddType text/html php


       AddHandler php5-script php
       AddType text/html php

    You probably want to put this AddHandler after the one for aspdotnet.

    LVL 18

    Author Comment

    by:Sudaraka Wijesinghe
    Thanks sleep_furiously,

    Your solution answer helped me to resolve this problem.

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now