繁体   English   中英

如何从默认主页重定向到索引页面?

[英]How to redirect from default home page to index page?

假设您有一个example.com网站。 如果您要在搜索栏中输入example.com,则会被带到该网站的索引页。 但是,此页面在技术上与example.com/index.html不同。

var currentPage = window.location.href

我在某些条件语句中使用了上面的JS方法来确定当前页面并相应地调整格式,但是由于example.com和example.com/index.html之间的差异而无法使用,因此我将如何执行这种操作重定向?

// Similar behavior as an HTTP redirect
window.location.replace("http://stackoverflow.com");

// Similar behavior as clicking on a link
window.location.href = "http://stackoverflow.com";

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM