我想让每个访问过的单个页面首先重定向到模板.php具有原始目标永久链接的页面,如AdFly缩短网址服务。
至于现在它使用 PHP header() 函数工作。但是我不知道如何将原始源页面永久链接包含在模板中.php
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.yournewwebsite.com/template.php");
?>
您可以将链接作为位置中的参数传递。
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://example.com/template.php?website=" . $_SERVER['REQUEST_URI']);
在您的template.php
中,只需执行$_GET['website']
即可检索在参数中传递的URL。