【发布时间】:2017-12-10 10:11:55
【问题描述】:
我有一个网站(例如https://example.com),并且它(除其他外)有一个名为origpage.php 的页面。但是,当来自给定域(例如http://example.net)的访问者想要打开origpage.php 时,我不想打开它。我希望这个访问者被重定向到另一个页面,例如。 otherpage.php。
我该怎么做?
(我认为“问题重复”并非如此。)
【问题讨论】:
-
您可能正在寻找
$_SERVER['HTTP_REFERER']和parse_url -
你是说当一个人使用
https://example.com/origpage.php时,让他留在页面上。但如果他使用http://example.net/origpage.php,那么将他重定向到http://example.net/otherpage.php? -
没有。如果有人想打开
https://example.com/origpage.php,那么这个页面就会被打开。除非有人来自http://example.net。他必须被重定向到https://example.com/otherpage.php