简体   繁体   English

只允许查看从 example.com/login 重定向的页面

[英]Only allow to view a page that is redirected from example.com/login

I want a page that can be only accessible who is redirected from example.com/login我想要一个只有从example.com/login重定向的人才能访问的页面

As example, if I directly visit example.com/alice.php it will redirect me to an error page.例如,如果我直接访问example.com/alice.php它会将我重定向到错误页面。 example.com/alice.php can be only accessible if a visitor was redirected from example.com/login . example.com/alice.php如果游客在重定向只能访问example.com/login

How can I do that with php?我怎样才能用 php 做到这一点?

perhaps you can use this as:也许您可以将其用作:

<?php
//your-url-which-you-do-not-what-direct access
$url != 'http://example.com/alice.php';

if ($_SERVER['HTTP_REFERER'] == $url) {
  header('Location: http://example.com/error.php'); //redirect to some other page
  exit();
}

?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从标题为example.com的页面传递表单?a = 100? - How to pass form from a page with header as example.com?a=100? example.com/wp-login.php将我重定向到example.com/example.com/wp-admin - example.com/wp-login.php redirects me to example.com/example.com/wp-admin 如何将所有example.org流量从仅1个国家/地区重定向到example.com? - How to redirect all example.org traffic to example.com from ONLY 1 country? htaccess example.com/page.php?cat=berlin&amp;page=2到example.com/berlin/2 - htaccess example.com/page.php?cat=berlin&page=2 to example.com/berlin/2 是否可以将 example.com/index.php?page=abc 重定向到 example.com/abc? - Is it possible to redirect the example.com/index.php?page=abc to example.com/abc? Avoid multiple page redirects http://example.com &gt; https://example.com -&gt; https://www.example.com - Avoid multiple page redirects http://example.com > https://example.com -> https://www.example.com 如何处理从example.com/search/?s=some到example.com/search/some的URL - How to manipulate the URL from example.com/search/?s=some to example.com/search/some Nginx RewriteURL从example.com/script.php?param=value到example.com/value - Nginx rewriteurl from example.com/script.php?param=value to example.com/value 仅在从特定页面重定向时才允许访问? - Allow access only when redirected from a particular page? 仅当用户从某个页面重定向时才允许调用PHP吗? - Only allow call of PHP when user is redirected from a certain page?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM