tes*_*ing 5 php apache permissions .htaccess web
我有一个Weblication,它只向某些用户提供对某些页面的访问权限.现在这些页面上链接了一些文件.如果有人拥有该URL,则每个人都可以访问这些文件(在本例中为搜索引擎).这应该改变!我该如何保护这样的目录?我想到了两个可能性:
还有其他可能性吗?
从此链接获取并翻译(但仅在WaybackMachine中可用)。
\n\n借助该功能,wCheckPermissionViewFile可以对 php 文件进行个性化。在文件头中执行权限检查就足以抑制输出。如果需要个性化其他文件类型(例如 ZIP、PDF...),wPermission.cgi或者可以使用自定义 php 文件。
wPermission.cgi为了节省编辑器在每个个性化链接到二进制文件之前的编写工作,mod_rewrite可以使用 Apache 模块。这样就可以在执行之前转换每个访问的链接。例如,您可以wPermission.cgi在每个网络服务器调用之前定义它。直接执行也可以借助 php 文件进行重定向(没有wPermission.cgi必要)。
.htaccess通过 Perl ( wPermission.cgi)检查的文件示例#Alle Dateien mit angegebener Endung \xc3\xbcber wPermission.cgi aufrufen.\nRewriteEngine on\nRewriteCond %{REQUEST_URI} .pdf$ [NC,OR]\nRewriteCond %{REQUEST_URI} .doc$ [NC,OR]\nRewriteCond %{REQUEST_URI} .xls$ [NC,OR]\nRewriteCond %{REQUEST_URI} .ppt$ [NC,OR]\nRewriteCond %{REQUEST_URI} .pps$ [NC,OR]\nRewriteCond %{REQUEST_URI} .zip$ [NC,OR]\nRewriteCond %{REQUEST_URI} .jpg$ [NC,OR]\nRewriteCond %{REQUEST_URI} .jpeg$ [NC,OR]\nRewriteCond %{REQUEST_URI} .png$ [NC,OR]\nRewriteCond %{REQUEST_URI} .gif$ [NC]\nRewriteRule (.*) /cgi-bin/wPermission.cgi?file=/de/dokumente/$1\nRun Code Online (Sandbox Code Playgroud)\n\n.htacces通过 PHP 检查的文件示例(例如download.php,见下文)#Alle Dateien mit angegebener Endung \xc3\xbcber die angegebene PHP-Datei aufrufen.\nRewriteEngine on\nRewriteCond %{REQUEST_URI} .pdf$ [NC,OR]\nRewriteCond %{REQUEST_URI} .doc$ [NC,OR]\nRewriteCond %{REQUEST_URI} .xls$ [NC,OR]\nRewriteCond %{REQUEST_URI} .ppt$ [NC,OR]\nRewriteCond %{REQUEST_URI} .pps$ [NC,OR]\nRewriteCond %{REQUEST_URI} .zip$ [NC,OR]\nRewriteCond %{REQUEST_URI} .jpg$ [NC,OR]\nRewriteCond %{REQUEST_URI} .jpeg$ [NC,OR]\nRewriteCond %{REQUEST_URI} .png$ [NC,OR]\nRewriteCond %{REQUEST_URI} .gif$ [NC]\nRewriteRule (.*) /de/download.php?path=/de/dokumente/$1\nRun Code Online (Sandbox Code Playgroud)\n\n如果您想个性化目录中的所有 PDF 和 ZIP 文件/de/dokumente而不更改链接,您可以将.htaccess文件放入该目录中。在此文件中定义了重定向规则。
该规则可以用任意文件扩展名进行扩展,NC代表不区分大小写。请注意,规则也会继承到子目录。
二进制文件本身必须签入并提供相应的个性化设置。
\n\n如果您想检查文件是否处于有效的发布时间段(例如在线或离线),请在通过 PHP API 进行权限检查之前进行检查wIsOnline。
.htacces通过 PHP 检查的文件(例如download.php)”#Alle Dateien mit angegebener Endung \xc3\xbcber wPermission.cgi aufrufen.\nRewriteEngine on\nRewriteCond %{REQUEST_URI} .pdf$ [NC,OR]\nRewriteCond %{REQUEST_URI} .doc$ [NC,OR]\nRewriteCond %{REQUEST_URI} .xls$ [NC,OR]\nRewriteCond %{REQUEST_URI} .ppt$ [NC,OR]\nRewriteCond %{REQUEST_URI} .pps$ [NC,OR]\nRewriteCond %{REQUEST_URI} .zip$ [NC,OR]\nRewriteCond %{REQUEST_URI} .jpg$ [NC,OR]\nRewriteCond %{REQUEST_URI} .jpeg$ [NC,OR]\nRewriteCond %{REQUEST_URI} .png$ [NC,OR]\nRewriteCond %{REQUEST_URI} .gif$ [NC]\nRewriteRule (.*) /cgi-bin/wPermission.cgi?file=/de/dokumente/$1\nRun Code Online (Sandbox Code Playgroud)\n\n对于较新版本的Weblication 此链接可能会有所帮助。它是德语,因为制造商的主要语言是德语。