继续优化
SetEnvIf Request_URI "\/SAVE\/(.*)$" save_file_name="$1"
SetEnvIf Request_URI "\.(jpg|jpeg|png|gif|bmp)$" is_image_file
#除了图片,其他文件直接访问均提示下载,防止上传了js,css,html等不应该被浏览器加载的文件
Header set Content-Disposition attachment env=!is_image_file
Header set Content-Disposition "attachment; filename=%{save_file_name}e" env=save_file_name
RewriteEngine On
RewriteRule ^/(.*)\/SAVE\/.*$ /$1 [L]
------------------------------------------------------- 优化一下~
SetEnvIf Request_URI "\/SAVE\/(.*)$" save_file_name="$1"
Header set Content-Disposition "attachment; filename=%{save_file_name}e" env=save_file_name
RewriteEngine On
RewriteRule ^/(.*)\/SAVE\/.*$ /$1 [L]
只需要访问 : ....5_1300238850.jpg/SAVE/我的图片.jpg 就可以了,ie下文件名后面竟然也不会出现“[1]”了~ ----------------------------------------
SetEnvIf Request_URI "_DOWN_NAME_(.*)_DOWN_EXT_(.*)$" save_file_name="$1.$2"
#下面这种ie下有问题
#SetEnvIf Request_URI "_DOWN_NAME_(.*)$" save_file_name="$1"
Header set Content-Disposition "attachment; filename=%{save_file_name}e" env=save_file_name
RewriteEngine On
RewriteRule ^/(.*)\._DOWN_NAME_.*$ /$1 [L]
实现的效果: 假设一个附件上传后的地址是: http://foo.com/03/21/1bc5b77f3e50b7fbe12c792ee438da45_1300688708.jpg 如果想要指定下载名,则访问: http://foo.com/03/21/1bc5b77f3e50b7fbe12c792ee438da45_1300688708.jpg._DOWN_NAME_我的图片_DOWN_EXT_jpg ie下的效果: screenshot_127.pngscreenshot_127.png chrome下的效果: screenshot_128.pngscreenshot_128.png FF下的效果,很杯具: screenshot_129.pngscreenshot_129.png ----------- vim->email->wordpress