Javascripti ümbersuunamise URL

URL-i lehe ümbersuunamine Javascriptiga.

Javascripti ümbersuunamine ei tagasta püsivat ümbersuunamise olekukoodi 301.

JavaScripti ümbersuunamine

Asendage vana leht ümbersuunamiskoodiga selle lehe URL-iga, kuhu soovite ümber suunata.

vana-leht.html:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
    // Javascript URL redirection
    window.location.replace("http://www.mydomain.com/new-page.html");
</script>
</body>
</html>

 

Otsingumootorid kasutavad olekukoodi 301, et teisaldada lehe asetus vanalt URL-ilt uuele URL-ile.

Javascripti ümbersuunamine tagastab http vastuse olekukoodi: 200 OK.

Seega ei ole Javascripti ümbersuunamine otsingumootorisõbralik ja parem on kasutada muid ümbersuunamismeetodeid, mis tagastavad olekukoodi: 301 Moved Permanently.

Javascripti ümbersuunamise näide

javascript-redirect-test.htm

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
// Javascript URL redirection
window.location.replace("https://cmtoinchesconvert.com/et/web/dev/javascript-redirect.htm");
</script>
</body>
</html>

 

Vajutage seda linki, et suunata saidilt javascript-redirect-test.htm tagasi sellele lehele:

 

Javascripti ümbersuunamise test

 

 

URL-i ümbersuunamine ►

 


Vaata ka

Advertising

VEEBIARENDUS
°• CmtoInchesConvert.com •°