.htaccess + mod_rewrite是epub-files (epub-shop)权限管理的正确方式吗?


is .htaccess + mod_rewrite the right way to manage the permission for epub-files (epub-shop)?

我想通过网上商店交付epub-file。是。htaccess + mod_rewrite正确的方式来管理epub-files (epub-shop)的权限?

# .htaccess in epub-folder
# sends every file to "download.php"
RewriteEngine On
RewriteRule '.php$ - [L]
RewriteRule (.*) download.php?file=$1

download.php管理许可证部分。有没有什么方法可以在没有许可证的情况下获取文件?直接通过深链接?

谢谢你的帮助!

通常通过mod_authz_host中的指令进行访问控制。本文档概述了如何做到这一点。

如果您可以访问Apache的主配置文件(httpd.conf或类似的文件),我建议在其中添加一个目录部分。然后你需要重新启动你的Apache。

<Directory /a/b/c/epub/>
  Order Deny,Allow
  Deny from all
</Directory>

Order表示指令的处理顺序。Deny from all拒绝所有人的直接访问。

否则,你可以在epub目录中添加一个。htaccess,然后在其中添加相同的两个指令,不需要目录块。