• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 428
  • Last Modified:

Issue with AddHandler and file names

I recently installed the mod_aspdotnet on my Apache server, which required to ad the followin line to httpd.conf

AddHandler asp.net 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?

Thanks.

P.S.
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)
0
Sudaraka Wijesinghe
Asked:
Sudaraka Wijesinghe
1 Solution
 
caterham_wwwCommented:
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)$">
SetHandler asp.net
</FilesMatch>
0
 
Sudaraka WijesingheWeb Application ProgrammerAuthor Commented:

Thanks for the reply caterham_www
but no luck, mod_aspdotnet doesn't seem to work with the method you mentioned.
0
 
periwinkleCommented:
Is there an AddHandler command for .php files?  What happens if you swap the order of the ASP and PHP handlers?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
Sudaraka WijesingheWeb Application ProgrammerAuthor Commented:
Nope, there's no AddHandler for .php
0
 
sleep_furiouslyCommented:
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

(php5):

   AddHandler php5-script php
   AddType text/html php

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

0
 
Sudaraka WijesingheWeb Application ProgrammerAuthor Commented:
Thanks sleep_furiously,

Your solution answer helped me to resolve this problem.
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Tackle projects and never again get stuck behind a technical roadblock.
Join Now