302重定向php ||一步一步


302 Redirect php || Step by Step

根据您的表格,我理解以下流程:如果有错误,请纠正我。

我需要把www.domian.com/About.php改成www.domian.com/about.php

我需要创建about.php文件

步骤2我需要把代码:重定向301/About.php " www.domian.com/about.php"的代码在haccess文件。

我需要在about.php中定义规范标记

现在之后,在未来我想做的改变只在大约。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>

希望有帮助。如果你还需要帮助,请联系我