htaccess无法打开服务器上传的文件

时间:2012-01-21 22:20:15

标签: apache .htaccess file-upload

我正在通过脚本将mp3文件上传到我的网站,但是当我尝试下载它们或者使用HTML5播放器播放它们时,它们就不会运行。

下载文件链接如下所示:

http://test.entreplus.com/content/plugins/post_audio/uploadify-local/uploads/Mac.(Miller)!%20-%20Jerry's%20Record%20Store.mp3

当我尝试下载它时,它会将我重定向到主页面。

它只发生在实际网站上,虽然在localhost中它可以正常工作。

有人可以看看我的.htaccess文件并查看问题是否存在吗?

Options +Indexes +FollowSymlinks
RewriteEngine on

## Redirect www.example.com to example.com. Add ## if you don't need the redirect.
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

AddType application/x-shockwave-flash swf

# BEGIN EXPIRES
#cache html and htm files for one day
<FilesMatch ".(html|htm)$">
Header set Cache-Control "max-age=43200"
</FilesMatch>

#cache css, javascript and text files for one week
<FilesMatch ".(js|css|txt)$">
Header set Cache-Control "max-age=604800"
</FilesMatch>

#cache flash and images for one month
<FilesMatch ".(flv|swf|ico|gif|jpg|jpeg|png)$">
Header set Cache-Control "max-age=2592000"
</FilesMatch>

#disable cache for script files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
# END EXPIRES

<IfModule mod_gzip.c>  
    mod_gzip_on Yes  
    mod_gzip_dechunk Yes  
    mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$  
    mod_gzip_item_include handler ^cgi-script$  
    mod_gzip_item_include mime ^text\.*  
    mod_gzip_item_include mime ^application/x-javascript.*  
    mod_gzip_item_exclude mime ^image\.*  
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*  
</IfModule>

##### CORE ADMIN #####
RewriteRule ^admin/?$ admin_index.php [L]
RewriteRule ^admin/([a-zA-Z0-9_-]+)/?$ admin_index.php?page=$1 [L]
RewriteRule ^admin/plugin_settings/plugin/([a-zA-Z0-9_-]+)/?$ admin_index.php?page=plugin_settings&plugin=$1 [L]

##### GENERIC RULES #####
RewriteRule \.(css|php|png|jpg|gif|ico|js|inc|txt|gz|xml|html)$ - [NC,L]
RewriteRule ^([^/]*)/?$ index.php?page=$1 [L]
RewriteRule ^([^/]*)/([^/]*)/?$ index.php?$1=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/?$ index.php?page=$1&$2=$3 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?$1=$2&$3=$4 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?page=$1&$2=$3&$4=$5 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$ index.php?$1=$2&$3=$4&$5=$6 [L]

1 个答案:

答案 0 :(得分:0)

正如Ulrich Palha所写,答案是

  

排除正在处理的.mp3文件,例如将mp3添加到此处   RewriteRule。(mp3 | css | php | png | jpg | gif | ico | js | inc | txt | gz | xml | html)$ -   [NC,L]