Forum Moderators: phranque

Message Too Old, No Replies

how to block the other file extensions

FilesMatch

         

ianlin

1:40 pm on Jan 29, 2004 (gmt 0)



Hi, I'm new aroung here

My question is how to configure the httpd.conf to allow ONLY files with the extensions .html, .php, .jpg to be serverd.(means other file extensions should not be served)

I've tried to use filemsatch as the following, but it seems not working. Could someone give me a hint or help to figure it out.

<FilesMatch "\.(gif¦jpe?g¦png¦php¦html)$">
Order allow, deny
Allow from all
</FileMatch>

ALL help is greatly appreciated.

jdMorgan

5:57 pm on Jan 29, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ianlin,

Welcome to WebmasterWorld [webmasterworld.com]!

I've successfully used something like this in the past:


SetEnvIf Request_URI "\.(gif¦jpe?g¦png¦php¦html)$" allowit
<Files *>
Order Allow,Deny
Allow from allowit
</Files>

Replace the broken pipe "¦" characters above with solid pipe characters from your keyboard.

Jim