How to redirect HTML pages? [ Solved ] | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 13

How to redirect HTML pages? [ Solved ]

22nd Apr 2019, 9:47 AM
Blah
10 Respostas
+ 7
You can do this. <meta http-equiv="refresh" content="0; url=http://example.com/" /> Just place it inside the head tag and put in the url you want to redirect to.
22nd Apr 2019, 10:14 AM
Bela Brockmann
Bela Brockmann - avatar
+ 17
SEO specialists reccommend in .htaccess
22nd Apr 2019, 8:49 PM
Sławek J.
+ 7
The simplest way to redirect to another URL is to use an HTMLĀ <meta>Ā tag with the http-equiv parameter set to ā€œrefreshā€. The content attribute sets the delay before the browser redirects user to the new web page. For redirect to occur immediately set this parameter to ā€œ0ā€ seconds for theĀ contentattribute. Example <!DOCTYPE html> <html> <head> <meta http-equiv="Refresh" content="0; url=https://www.w3docs.com" /> </head> </html>
22nd Apr 2019, 10:38 PM
Bilal Ahmed
Bilal Ahmed - avatar
+ 6
you can redirect in js using: window.location="https://yoursite.com";
23rd Apr 2019, 3:56 AM
Adler Vuong
Adler Vuong - avatar
+ 5
Use <meta http-equiv="refresh" content="5; url=http://www.google.com " /> *Note the value of the content attribute determines the amount of time ( in seconds) it will take before redirection . The one above will take 5 seconds
23rd Apr 2019, 7:45 AM
Jedidiah ShonolašŸ‡³šŸ‡¬
Jedidiah ShonolašŸ‡³šŸ‡¬ - avatar
+ 4
Thanks clab02 for the answer. I found an alternate using JavaScript window.location.href = "https://example.com"
22nd Apr 2019, 2:09 PM
Blah
+ 4
You can redirect the server side page (like aspx) and the HTML page will follow suit šŸ˜Ž
22nd Apr 2019, 3:10 PM
Sanjay Kamath
Sanjay Kamath - avatar
+ 2
If you want to show something and then redirect to another webpage <meta http-equiv="refresh" content="0; URL='http://example.com'" /> Immediate redirect window.location = "http://example.com"; weird stuff is this works in different versions window.location.href = "http://example.com"; window.location.assign("http://example.com"); window.location.replace("http://example.com"); if use Apache and have access to .htaccess you can use Redirect 301 /page.html http://www.example.com/new-page.html in Php <?php header('Location: http://www.example.com'); exit; ?> in Node.js var http = require("http"); http.createServer(function(req, res) { res.writeHead(301,{Location: 'http://example.com'}); res.end(); }).listen(8888);
22nd Apr 2019, 3:06 PM
Salvador Bravo
Salvador Bravo - avatar
+ 1
<!DOCTYPE html> <html> <head> <title>HTML Meta Tag</title> <meta http-equiv = "refresh" content = "2; url = https://www.tutorialspoint.com" /> </head> <body> <p>Hello HTML5!</p> </body> </html>
24th Apr 2019, 7:53 AM
Mudassir Khan
Mudassir Khan - avatar
- 3
gg
22nd Apr 2019, 7:49 PM
ƖzgĆ¼r Taşdemir
ƖzgĆ¼r Taşdemir - avatar