HTML redirection

 

HTML redirection

HTML redirect. HTML meta refresh redirection code.

HTML meta refresh redirect is a client side redirect and is not 301 permanent redirect.

The HTML meta refresh with 0 seconds time interval, is considered by Google as a hint for 301 redirect for pagerank transfer.

If you want to do real 301 permanent redirect, you can do it with PHP redirect after enabling PHP code in HTML files.

 

HTML meta refresh redirect

The redirection is done with the meta refresh in the head section.

The link in the body section for fallback purposes.

Replace old page with redirection code with the URL of the page you want to redirect to.

old-page.html:

<!DOCTYPE html>
<html>
<head>
   <!-- HTML meta refresh URL redirection -->
   <meta http-equiv="refresh"
   content="0; url=http://www.mydomain.com/new-page.html">
</head>
<body>
   <p>The page has moved to:
   <a href="http://www.mydomain.com/new-page.html">this page</a></p>
</body>
</html>

 

HTML meta refresh redirect example

html-redirect-test.htm:

<!DOCTYPE html>
<html>
<head>
   <!-- HTML meta refresh URL redirection -->
   <meta http-equiv="refresh"
   content="0; url=https://www.calculatorx.com/web/dev/html-redirect.htm">
</head>
<body>
   <p>The page has moved to:
   <a href="https://www.calculatorx.com/web/dev/html-redirect.htm">this page</a></p>
</body>
</html>

 

Press this link to redirect from html-redirect-test.htm back to this page:

 

HTML meta refresh redirect test

 

HTML canonical link tag redirect

The canonical link does not redirect to the preferred URL, but it can be an alternative to URL redirection for websites that most of the traffic arrives from search engines.

HTML canonical link tag can be used when there are several pages with similar content and you want to tell the search engines which page you prefer to use in the search results.

Canonical link tag can link to the same domain and also cross-domain.

Add the canonical link tag to the old page to link to the new page.

Add the canonical link tag to the pages that you prefer not to get search engines traffic to link to the preferred page.

The canonical link tag should be added in the <head> section.

old-page.html:

<link rel="canonical" href="http://www.mydomain.com/new-page.html">

 

URL redirection ►

 

See also