All TalkersCode Topics

Follow TalkersCode On Social Media

devloprr.com - A Social Media Network for developers Join Now ➔

Auto Redirect HTML Code

Last Updated : Mar 11, 2024

Auto Redirect HTML Code

In this tutorial we will show you the solution of auto redirect HTML code, auto redirect means automatically the current url will points the another page url so the result of website will display on same page.

This technique used for sole purpose of ranking highly in the search engine.

When visitors arrive at a page on the site, from a listing in the search engine results they are automatically redirect to the main site.

Let see below how to implement the auto redirection in html with step by step guidance.

Step By Step Guide On Auto Redirect HTML Code :-

Using <meta> tag we can redirect to another page easily. <meta> tag defines metadata about an HTML document and defined inside the <head> tag.

It is used to specify character set, page description, keywords, author of the document and viewport settings.

Within <meta> tag parameters of http-equiv, content and url used for auto redirect.

<!DOCTYPE html>
<html>
  <head>
    <title>Auto redirect</title>
    <meta http-equiv="Refresh" content="7; url='https://www.google.com/'">
  </head>
  <body>
  </body>
</html>
  1. <!DOCTYPE html> tag which is instruct the web browser about what version of HTML file written in.
  2. The<html> tag is used to indicate the beginning of HTML document.
  3. As above shown <head> tag is containing information about webpage and if you need any external file those links are declared here. <title> tag is used for set the webpage title.
  4. Already we said <meta> tag needs to define between <head> tag. For auto redirect parameters of http-equiz to value ‘Refresh’, content value to ‘0’ and url value we can set to sites url.
  5. Here we used google link and when content used for delay before move to another page. When it is ‘0’ loads website immediately and we sets to ‘7’ so it takes 7seconds delay for loading google page.
  6. http-equiz attribute used to provide header information or value of the content attribute. It can be used to simulate an HTTP Header response.
  7. After code implementation, internet connection is must when loads the files on web browser so we can see the output on webpage. Without internet connection file load will fail.
  8. Both <head> and <title> tags having their pair end tag, so we need to close the ending tags respectively. If your not closed anyone of ending tag properly that is also affect the webpage result.
  9. <body> tag is beginning of main coding part because it contain coding of entire website blocks and elements described here.
  10. Both </body>,</html> tags closed respectively. </body> tag indicates the end of body, Then </html> tag indicates the end of HTML document.

Conclusion :-

In conclusion we are able to know about meta tag, its attribute uses and how to implement auto redirection.

Meta tags are important because they impact how your site appears in the SERPs and how many people will be inclined to click through to your website.

Which impact your SEO and rankings, this is important part of a solid SEO strategy.

I hope this tutorial on auto redirect HTML code helps you and the steps and method mentioned above are easy to follow and implement.

Author Image About Amruta

Amruta is an Experienced web developer with 4 years for experience she completed her master's with MCA and passionate about programming Languages for creating technical contents like HTML, CSS, JavaScript, Java, Python, PHP, jQuery.

Follow Amruta On Linkedin 🡪