How to Redirect a Web Page in HTML
To tell search engines and website visitors that your web page has permanently moved to a newlocation with an equivalent content use a 301 redirect. The code “301” is interpreted as “movedpermanently”. (Learn more about
HTTP Status Codes
).
CSS - The Complete Guide (incl. Flexbox, Grid & Sass)
How to redirect to another URL
The simplest way to redirect to another URL is to use an
HTML <meta>
tag with the http-equivparameter set to “refresh”. The
content
attribute sets the delay before the browser redirects theuser to the new web page. To redirect immediately, set this parameter to “0” seconds for the
content
attribute.
If you want your redirection to occur in an exact time, just specify your preferred parameter (inseconds) for the
content
. Let’s consider an example, where we set "7" seconds as redirection time.
Some browsers don't render the <meta> refresh tag correctly, so before the next page loads,the user can see a fl ash as a page.
<meta http-equiv="Refresh" content="0; url='https://www.w3docs.com'" />
<meta http-equiv="refresh" content="7; url='https://www.w3docs.com'" />
Some old browsers don't refresh correctly when you add a quick link. In that case, you can add an
anchor
link to let the user follow.
Example of redirecting a web page:
Learn more about redirecting web pages with
JavaScript
,
PHP
,
Apache
and
Node.js
.
Related Resources
How to Redirect a Web Page with JavaScript
How to Redirect a Web Page with PHP
How to Redirect a Web Page with Node.js
How to Redirect a Web Page with Apache
<!DOCTYPE
html
>
<
html
>
<
head
>
<
meta
http-equiv
=
"refresh"
content
=
"7; url='https://www.w3docs.com'"
/>
</
head
>
<
body
>
<
p
>
Please follow
<
a
href
=
"https://www.w3docs.com"
>
this link
</
a
>
.
</
p
>
</
body
>
</
html
>
No comments:
Post a Comment