Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 你能重定向吗;http:example.com/folder";到http://www.example.com"?_Html - Fatal编程技术网

Html 你能重定向吗;http:example.com/folder";到http://www.example.com"?

Html 你能重定向吗;http:example.com/folder";到http://www.example.com"?,html,Html,只是想知道这是否可行?您可以使用htaccess或位于“文件夹”文件夹中的单个HTML文件 只需在文件夹中添加一个index.html文件。然后添加以下代码: <!DOCKTYPE html> <html> <head> <meta http-equiv="refresh" content="0; url=http://example.com/" /> </head> <body> You will be r

只是想知道这是否可行?

您可以使用htaccess或位于“文件夹”文件夹中的单个HTML文件

只需在文件夹中添加一个index.html文件。然后添加以下代码:

<!DOCKTYPE html>
<html>
<head>
    <meta http-equiv="refresh" content="0; url=http://example.com/" />
</head>
<body>
    You will be redirected...
</body>
</html>

您将被重定向。。。

meta标记中的“0”定义了访问者重定向后的秒数。如果他在页面上停留5秒钟,请键入5。

偏离路线,这是有多种方法可以实现的

/folder/中身体头部的元刷新:

<meta http-equiv="refresh" content="0; url=http://example.com/" />
重定向访问者

另一种方法是使用htaccess的重写模块

Redirect /old_dir/ http://www.yourdomain.com/new_dir/index.html
或者,如果您正在使用NginX,则服务器中的新位置将起作用:

rewrite ^(.*) http://www.example.com/$1 permanent;
所以这完全取决于你想要什么。如果您知道以上的一些解决方案更好,甚至无效。
例如,使用reqrite选项(最后两个),您可以告诉爬行器(google)页面被永久(301)或临时(302)重新定位。

Web应用程序服务器通常加载默认页面,如index.html。 在“文件夹”中,您可以添加如下HTML页面:

绝对路径:

<HTML>
   <HEAD>
       <META http-equiv="refresh" content="0; url=http://example.com" />
   </HEAD>
   </BODY>
   </BODY>
</HTML>

相对路径:

<HTML>
   <HEAD>
       <META http-equiv="refresh" content="0; url=.." />
   </HEAD>
   </BODY>
   </BODY>
</HTML>

JS风格:

<HTML>
   <HEAD>

   </HEAD>
   </BODY onload="document.location.href='..'">
   </BODY>
</HTML>

读一下这个
<HTML>
   <HEAD>
       <META http-equiv="refresh" content="0; url=.." />
   </HEAD>
   </BODY>
   </BODY>
</HTML>
<HTML>
   <HEAD>

   </HEAD>
   </BODY onload="document.location.href='..'">
   </BODY>
</HTML>