[英]302 Redirect php || Step by Step
根据您的表格,我了解以下过程:如果出现问题,请纠正我。
我需要将www.domian.com/about.php更改为www.domian.com/about.php
步骤1,我需要创建about.php文件
步骤2我需要输入代码:在htacess文件中重定向301 /About.php“ www.domian.com/about.php”代码。
step3我需要在about.php中定义规范标签
现在以后,我只想在about.php中进行更改。 我也可以删除About.php因为不使用它吗? 如果有什么不对的地方请纠正我。
您实际上不必使用.htaccess
来重定向用户。 如果这样做,将很难。
我建议您在PHP文件中输入以下代码来重定向用户:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting you to *The Website*</title>
<link rel="canonical" href="<Your website>" />
</head>
<?php
# The code below will redirect the users to the site that you want to redirect to.
# If the site has HTTPs, please change the "http://" to "https://"
header('Location: http://*Where you want the users to be redirected to*/');
exit();
# The "exit" code will prevent any more redirects in the current page.
?>
</html>
一个例子:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting you to GhostAnti DDoS</title>
<link rel="canonical" href="https://fantomnet.cf/" />
</head>
<?php
# The code below will redirect the users to the site that you want to redirect to.
# If the site has HTTPs, please change the "http://" to "https://"
header('Location: https://ghostantiddos.com/');
exit();
# The "exit" code will prevent any more redirects in the current page.
?>
</html>
希望能有所帮助。 如果您仍然需要帮助,请打我
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.