< filesmatch>只对一个页

编程入门 行业动态 更新时间:2024-10-28 20:23:18
本文介绍了< filesmatch>只对一个页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个需要只在首页上有如下Filesmatch在这里.pdf文件要问开放前,但在该网站的其他.pdf文件(没有在主页上)我要自动打开。这是实现这一目标的最佳方式是什么?

I have a need to have only the home page have the following Filesmatch where .pdf files need to ask before opening up, but other .pdf files in the site (not on the home page) I want to open automatically. Is this the best way to accomplish this?

这是一个Word preSS网站,最新版本,主页是一组页面。此外,该网站所有者可以在网站中添加更多的.pdf的链接,所以我不希望她有她每次添加一个文件的时间来处理code到复杂太多。

This is a Wordpress site, latest version, and the home page is a set page. Also, the owner of the site could add more .pdf links within the site so I don't want to complicate it too much where she has to manipulate code every time she adds a file.

下面是目前什么是我的.htaccess文件:

Here is what is currently in my .htaccess file:

# Use PHP5 as default AddHandler application/x-httpd-php5 .php ErrorDocument 404 /index.php ErrorDocument 403 /index.php #BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ www.dramanotebook/$1 [R,L] <Files 403.shtml> order allow,deny allow from all </Files> <FilesMatch "\.pdf$"> ForceType applicaton/octet-stream Header set Content-Disposition attachment </FilesMatch> # END WordPress

在此先感谢, 吉姆

Thanks in advance, Jim

推荐答案

我能够通过使用来完成这个&LT;文件&GT;&LT; /文件&GT;

I was able to accomplish this by using <Files></Files>.

例如:

<Files "filenameexample.pdf"> ForceType applicaton/octet-stream Header set Content-Disposition attachment </Files>

的技巧是,你需要添加一个&LT;文件&GT;&LT; /文件&GT; 对于要单独控制每个文件。没有选项说所有的PDF此页面上得到保护,但其他网页做别的事情。其实,你could..but你就必须把.htaccess文件每个文件夹中,以恢复回另一种方式的扩展。疯。更快只是做了3个文件,我需要明确。

The trick is you need to add a <files></files> for each file you want to individually control. There are no options to say "all PDF's on this page be protected, but other pages do something else". Actually, you could..but you would have to put an .htaccess file in each folder to "revert" it back to another way for those extensions. Crazy. Faster just to do the 3 files I needed specifically.

我没有发现的网上信息有帮助,也没有任何反应。我只是测试了很多。

I found none of the information online helpful nor any responses. I just tested a lot.

吉姆

更多推荐

&LT; filesmatch&GT;只对一个页

本文发布于:2023-10-31 11:48:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1545994.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:只对   LT   filesmatch   GT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!