.htaccess 等效规则?

.htaccess 等效规则?

为了防止从其他网站访问(热链接)或直接访问(输入 URL),下面的 .htaccess 规则是否等效?

规则1

<files myfile_one.php>
order allow,deny
deny from all
</files>

<files myfile_two.php>
order allow,deny
deny from all
</files>

规则 2

RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
RewriteRule ^myfile_(one|two).php$ - [F,NC]

答案1

我认为对于您要完成的任务,我会说“是”,但如果您想要超级技术化,则需要注意的是,我认为这些指令可以匹配任何文件夹中的文件名,但 RewriteRule 仅在当前文件夹中。此外,我认为区分大小写,但由于 [NC],您的规则不区分大小写。

相关内容