想要将我的HTML页面重定向到网站首页

时间:2020-11-05 08:40:23

标签: php html css themes custom-wordpress-pages

我已经为我的wordpress网站主页创建了一个HTML页面,现在我想将该HTML页面重定向到我的网站主页。 该页面已经上传到我的wordpress文件夹根目录

3 个答案:

答案 0 :(得分:1)

如果您打算从new.html页重定向到wordpress index.php文件:

使用PHP重定向:

header('Location: http://www.example.com/');

使用HTML Meta重定向:

<meta http-equiv = "refresh" content = "2; url = https://www.example.com" />

使用Javascript重定向:

window.location.href = "http://www.example.com";
window.location.replace("http://www.example.com");

答案 1 :(得分:0)

只需使用meta refresh属性即可重定向到其他站点。

(content =“ 0;将立即进行重定向。)

<meta http-equiv="refresh" content="0;url=http://example.com/" />

答案 2 :(得分:0)

将以下代码添加到html页面元标记中,以重定向到您的网站

    <head>
       <meta http-equiv = "refresh" content = "1; url = https://www.yoursite.com" />
</head>