我的登录页面去mywebsite.com/ dashboard.html?fromauth但如果这样做,没有?fromauth我想他们重定向到登录页面。面临的挑战是由于提供商的限制,我无法访问.htaccess
将URL更改为?fromauth=1
,然后可以使用JavaScript读取页面URL:
var URLString = window.location.href;
var URL = new URL(URLString);
var fromauth = URL.searchParams.get("fromauth");
if (fromauth != 1){
window.location.replace("http://www.mywebsite.com/login");
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句