gpt4 book ai didi

.htaccess - htaccess 带空格的文件名损坏

转载 作者:行者123 更新时间:2023-12-02 03:21:40 25 4
gpt4 key购买 nike

我不知道如何在下载时正确命名带有空格的文件名。名称在第一个空格处被打断。例如。文件

how are you.pdf

下载为

how

下面是我的代码。我已经尝试了很多东西,但到目前为止还没有一个奏效。

RewriteEngine On
##RewriteBase /
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?consciousnesscoachingacademy.com [NC]
RewriteRule \.(.*)$ - [NC,F,L]

RewriteCond %{QUERY_STRING} ^filename=(.*)$
RewriteRule ^download\.php$ %1
RewriteRule (.*) - [E=file:$1]
Header set Content-type "octet-stream"
Header set Content-disposition "attachment; filename=%{file}e" env=file

最佳答案

试试这段代码:

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?consciousnesscoachingacademy.com [NC]
RewriteRule \.(.*)$ - [NC,F,L]

# file download (attachment)
RewriteCond %{THE_REQUEST} /download\.php\?filename=(.+)\ HTTP/ [NC]
RewriteRule ^download\.php$ %1? [E=file:%1]

Header set "Content-disposition" "attachment; filename=\"%{REDIRECT_file}e\""
Header set "Content-type" "octet-stream"

关于.htaccess - htaccess 带空格的文件名损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32973401/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com