URLページをJavascriptでリダイレクトする方法。
Javascript リダイレクトは、301 永続的なリダイレクト ステータス コードを返しません。
old page with redirection code をリダイレクト先のページの URL に置き換えます。
古いページ.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>
検索エンジンは 301 ステータス コードを使用して、ページ ランクを古い URL から新しい URL に移します。
Javascript リダイレクトが http 応答ステータス コードを返します: 200 OK。
そのため、Javascript リダイレクトは検索エンジンに適していないため、ステータス コード 301 Moved Permanently を返す他のリダイレクト メソッドを使用することをお勧めします。
javascript-redirect-test.htm
<!DOCTYPE html>
<html>
<body>
<script
type="text/javascript">
// Javascript URL redirection
window.location.replace("https://cmtoinchesconvert.com/ja/web/dev/javascript-redirect.htm");
</script>
</body>
</html>
このリンクを押すと、javascript-redirect-test.htm からこのページにリダイレクトされます。
Advertising