Forum Moderators: phranque

Message Too Old, No Replies

.htaccess issue: 500 server error

server not allowing <Files ...> directives?

         

bacbbdd

7:40 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



Hi, I am new to Apache and am trying to allow indexing of files with names ending in temp.pdf and cat1.pdf in one particular directory but when I use the following as my .htaccess I get an internal server error.

Options +Indexes
Order Deny,Allow
<Files *>
Deny from All
</Files>
<FilesMatch ".*temp\.pdf$">
Allow from All
</FilesMatch>
<FilesMatch ".*cat1\.pdf$">
Allow from All
</FilesMatch>
It might be helpful to know that the directory contains many pdf files but we only want ones that end in temp.pdf or cat1.pdf to be visable.

The parent directory contains a working .htaccess. As a test, I modified that .htaccess to include the following (which also produced a 500 internal server error):
<Files .htaccess .htpasswd .htuser .htgroups *.pdf>
order allow,deny
deny from all
</Files>

The files were all written on a Unix box with vi. Could there be a global config setting that does not allow <Files> or other directives? If so what would that be? If there is a problem with the .htaccess file what is it?

many thanks!

D.

jdMorgan

7:55 pm on Mar 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



D,

Check out the AllowOverride [httpd.apache.org] settings. You'll need AllowOverride FileInfo at a minimum.

Jim

bacbbdd

8:06 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



Thanks Jim! Out of curiosity, Is the AllowOverride a global setting or can it be used in a .htaccess file?

Again, Thanks!

D.

bacbbdd

8:22 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



Interesting, I placed:

<Directory>
AllowOverride All
</Directory>
in the .htaccess located in the one that contains the pdf files and still got the 500 error. That directory is named pdf. I placed the following in pdf's parent's .htaccess
<Directory pdf>
AllowOverride All
</Directory>

This also gave a 500 error. Am I just doing something wrong?

jdMorgan

9:17 pm on Mar 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



From the documentation:

Note: AllowOverride is only valid in <Directory> sections, not in <Location> or <Files> sections, as implied by the Context section above.

<Directory> directive
Syntax: <Directory directory-path¦proxy:url-path> ... </Directory>
Context: server config, virtual host

AllowOverride is configured in httpd.conf.

Jim