Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to configure Apache to send most URI's to my mod_perl application with the exception of a few files, which I want to serve using the default handler. (send a static file)

I want all http://myserver.com/xxxxx to go to the mod_perl with /, /index.html, robots.txt and a few subfolders to be served statically.

I have tried a number of different combinations but I can't get it to work. There doesn't appear to be a way to negative < LocationMatches > or the like.

If I define the PERL variable, everything goes to the script, with it off, I can sever the static data, but obviously the script doesn't work.

<Directory /home/httpd/plaintext>
    AllowOverride None
    <Files ~ "(index.html|robots.txt|favicon.gif)">
          SetHandler default-script
    </Files>
        AddDefaultCharset utf-8 
    DirectorySlash off

    Order allow,deny
    Allow from all

</Directory>


<IfDefine PERL>
<Location />
          SetHandler perl-script
          PerlResponseHandler LinkCrunchDB::Handler
</Location>
</IfDefine>

I guess hacking the module to use internal redirects might work, but it's ugly.

I am using Gentoo Linux, which includes all files in the module.d/ folder then vhost.d folder. I have checked all of these and removed any Directory or Location folders, there wasn't any!

Many thanks.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

This is one of my long-standing annoyances with mod_perl, and ultimately why I'm glad Ruby on Rails came about.

Basically, you cannot share where your Perl scripts live and where the static content lives. They must be in different directories. I often cheated and used a different hostname for the static and dynamic content, which removed the whole issue. You can also read a little bit more about how to put static content in a subdirectory perhaps.

share|improve this answer
    
So you can't do it that way :-) I suspected as such. –  Chris Huang-Leaver Jan 18 '10 at 12:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.