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

I tried this code, although it works for some reason, aren't there mistakes in it?

I'm not sure what the best way to correct this is, but here it is...

<Files .+*^$[]()>
ForceType application/x-httpd-php
SetHandler application/x-httpd-php
</Files>

Not sure why it works; is this a regex error? Does this mean I could have an extensionless file with PHP code and images etc. and it would work well, or is there alternative code for this?

(bear in mind this is c&p'd from a PHP scripts forum...)

share|improve this question

1 Answer 1

No, this doesn't look like it follows PCRE. The Apache parsing is a subset of that. If you want to know exactly why it works, you'd need to download the apache source and start reading srclib/pcre/pcre.c.

If you're just looking to set the PHP handler for any file without an extension, something sane might look like this:

<FilesMatch ^\b\w*\b$>
    SetHandler application/x-httpd-php
</FilesMatch>

It's not clear what you mean by "works", however. You might mean that it doesn't create an error, or that it has some sort of other unexpected behavior that is useful..

share|improve this answer

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.