将条件重定向到新的URL,以便我可以编写“ONE脚本”并将其复制到同一脚本的所有当前旧HTML中。这将有助于那些已经为旧网址添加书签并重定向到新网址的用户。有条件的重定向URL java
我有一个旧webpeges像
www.oldsite.com/a1.html
www.oldsite.com/a1/5698.html
www.oldsite.com/x1.html
www.oldsite.com/YY1.html
,并希望得到一个用户的当前URL,并使用location.path和根据路径(后缀)012重定向到newsite.com即
www.oldsite.com/a1.html
到www.newsite.com/b1.html
www.oldsite.com/a1/5698.html
到www.newsite.com/b1/5698.html
www.oldsite.com/x1.html
到www.newsite.com/99.html
www.oldsite.com/YY1.html
到www.newsite.com/ZZ1.html
我已经尝试了很多次,但失败!
既然我是HTML的新人,任何人都可以帮助我吗? 我的网站举办了超过一百个老的HTML!
这里是我的草案
<html>
<head>
<javascript>
if window.location.path='/al.html'
{
window.location="http://www.newsite.com/b1.html"}
else if window.location.path='/al/5698.html'
{
window.location="http://www.newsite.com/b1/5698.html"}
.........
</script>
</head>
为什么在你的问题中使用'java'标记? – 2013-03-05 14:22:20
我猜java脚本可以解决我的问题 – user2136039 2013-03-05 14:51:38