Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 301重定向到PDF_.htaccess_Pdf_Redirect_Url Redirection - Fatal编程技术网

.htaccess 301重定向到PDF

.htaccess 301重定向到PDF,.htaccess,pdf,redirect,url-redirection,.htaccess,Pdf,Redirect,Url Redirection,有没有办法将目录直接重定向到.pdf文件?我已尝试在我的.htaccess文件中放入类似的内容: Redirect 301 /newsletters/today/ http://example.com/file.pdf 这是行不通的。有更好的方法吗 我知道我的.htaccess文件中的重定向正在工作,因为我可以通过将代码更改为以下内容将同一页面重定向到另一个目录: Redirect 301 /newsletters/today/ /newsletters/yesterday/ 当重定向指向.

有没有办法将目录直接重定向到.pdf文件?我已尝试在我的
.htaccess
文件中放入类似的内容:

Redirect 301 /newsletters/today/ http://example.com/file.pdf
这是行不通的。有更好的方法吗

我知道我的
.htaccess
文件中的重定向正在工作,因为我可以通过将代码更改为以下内容将同一页面重定向到另一个目录:

Redirect 301 /newsletters/today/ /newsletters/yesterday/

当重定向指向
.pdf
文件时,重定向不会发生。

尝试重定向时的结果是什么?根本没有重定向?不,根本没有重定向。这个.htaccess在哪里?您在浏览器中输入了什么URL?