1
我有这样的剧本,它的工作很好,但它重定向到谷歌如果URL是这样的:重定向如果URL中包含字
http://example.com/test/examples
if (window.location.href.indexOf("/test") > -1) {
window.location.href="http://google.hu";
}
我不想,如果我要重定向在/ test /之后的单词。
所以,我需要这样的:
http://example.com/test/examples - >不重定向
http://example.com/test --->重定向
我如何用jQuery做呢?
这是更好地在服务器上做重定向;客户端并不总是支持JavaScript或基于客户端的重定向。 –