【问题标题】:Htaccess - Allow access to specific file only if specific referrer is setHtaccess - 仅在设置了特定引用者时才允许访问特定文件
【发布时间】:2017-04-27 14:06:47
【问题描述】:

通过 .htaccess 我希望仅当从我的域上的特定页面访问时才允许访问特定的 .php 文件。

你会在 .htaccess 中使用什么代码来做到这一点?

【问题讨论】:

    标签: php .htaccess referrer


    【解决方案1】:

    嗯,你可以试试这样的:

    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^http://example.com/allowed/page/url$
    RewriteRule restricted\/page\.php - [NC,F]
    

    请注意,任何 HTTP 请求中的引用者都很容易被欺骗。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-04-21
      • 2017-12-24
      相关资源
      最近更新 更多