Reputation: 21
So i'm making a website, and I want it to redirect to another site automatically (instantly). I am aware of the Meta Refresh thing, but it doesn't instantly redirect. It takes like 3 seconds to redirect for me. I found a website a while ago that instantly redirected. So fast that View-Source couldn't see the source code. Thanks in advance
Upvotes: 2
Views: 3204
Reputation: 21
Use the meta refresh tag.
For an example, To display the title and the text with: You are being redirected...
But also instantly redirect with HTML use this:
<!DOCTYPE HTML>
<h1>You are being redirected....</h1>
<html>
<head>
<title>You are being redirected...</title>
`
Btw, Replace URL with your url and urlextension with somthiing like .com
Upvotes: 0
Reputation: 182
You can use this script to instantly go to another url:
<script>window.location.href = '[YourUrlHere]';</script>
You can also use a website to view the page source, for example I use:
https://www.view-page-source.com/
Upvotes: 2
Reputation: 672
You have to make your server emit a 301 redirect header.
This can't be done with HTML since it runs on the client (that's why the client has to download your HTML page first, and then get redirected).
Here's an example with PHP:
<?php header("Location: http://othersite.com");
And here's it using .htaccess:
Redirect 301 / http://othersite.com
Upvotes: 1