[英]How do I redirect a page from not having www. to www. with javascript?
Updated: Just use .htaccess please, if you're using JavaScript there's something 100% wrong with your code.更新:请使用 .htaccess,如果您使用的是 JavaScript,则您的代码有 100% 的错误。
window.location.href = window.location.protocol + "//www." + window.location.host
look at the location object for more info: https://developer.mozilla.org/en-US/docs/Web/API/Location查看位置对象以获取更多信息: https ://developer.mozilla.org/en-US/docs/Web/API/Location
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.