Forum Moderators: phranque
Just wondering if anyone could help me with a small problem.
I have a hosting account where people can upload files via FTP through a java applet. There are no restrictions as to what files can be uploaded.
Once the files are uploaded, I only want people to be able to download video files through HTTP... eg I only want to provide access to .wmv, .mpeg, .avi etc.
At the moment I have this -
AddHandler headered .jpg
AddHandler headered .jpeg
AddHandler headered .txt
AddHandler headered .htm
AddHandler headered .html
AddHandler headered .zip
AddHandler headered .gif
AddHandler headered .pdf
AddHandler headered .tar
AddHandler headered .tif
AddHandler headered .wav
AddHandler headered .bmp
AddHandler headered .exe
AddHandler headered .doc
AddHandler headered .xls
Action headered [[snip]...]
As you can see its a bit messy...
Id prefer to be able to specify what file types ARE allowed, is this possible?
Many Thanks
Tom.
Ive tried this -
<filesmatch (.avi¦.wmv¦.mpg¦.mov)>
Allow from all
</filesmatch> <filesmatch (.*)>
deny from all
</filesmatch>
ErrorDocument 403 http://[snip]/forum/index.php
and this -
<filesmatch (*\.avi¦*\.wmv¦*\.mpg¦*\.mov)>
Allow from all
</filesmatch> <filesmatch (.*)>
deny from all
</filesmatch>
ErrorDocument 403 http://[snip]/forum/index.php
but it seems that all files are getting redirected, any ideas?!
Thanks again for your help.
Also, be sure to allow "all" to fetch your ErrorDocument! -- Otherwise, you'll get a 403-Forbidden while trying to server the 404 error page...
The correct syntax for ErrorDocument uses a local URL-path only:
ErrorDocument 403 /forum/index.php
Otherwise, your server will return a 302-Found status, and not the desired 404-Not Found status. This is documented in the Apache ErrorDocument documentation [httpd.apache.org].
Further, you should not use an "index page" as an error document. Each type of error should go to a page that explains that specific error, and then offers a link to your home page, your site map, or another appropriate destination. Otherwise you will confuse both users and search engines, and the results are often "not good." You can optionally put a meta-refresh on that error page to help the helpless. As long as the meta-refresh timer is set to >5 seconds, this should not cause indexing problems.
Jim