Beginner question

J

John

Hi, if someone goes to a particular page on my web site, how can I make it
so another page is automatically loaded instead of the original page?

All the best, John.
 
T

Toby A Inkster

John said:
Hi, if someone goes to a particular page on my web site, how can I make it
so another page is automatically loaded instead of the original page?

Depends. Do you have server-side scripting? If not, then something like
this may be required:

=================================================================
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"> <html>
<head>
<script>
window.location.replace("http://www.example.org/page2.html");
</script>
<meta http-equiv="Refresh"
content="0;url=http://www.example.org/page2.html">
<title>Redirection</title>
</head>
<body>
<h1>Redirection</h1>
<p>Your browser should have been redirected automatically, but if you
are reading this, then it hasn't worked. Oh well, here is <a
href="http://www.example.org/page2.html">the page I would like you to
visit</a>.</p>
</body>
</html>
=================================================================

This uses three techniques to redirect the user. The <meta> tag should be
99% reliable, but for those browsers that don't support it, we add a basic
text link.

We add JavaScript, because it tends to redirect straight away, whereas
with the <meta> tag, browsers tend to wait for the entire page to load
before redirection.

Of course, none of this is as good as using proper HTTP headers, so if you
have some kind of server-side scripting capabilities, let us know,
including which scripting languages your server supports.
 
L

Leif K-Brooks

John said:
Hi, if someone goes to a particular page on my web site, how can I make it
so another page is automatically loaded instead of the original page?

If you're using Apache and have .htaccess rights, you can use that. To
redirect from foo.html to bar.html for instance, create a file named
..htaccess with this in it:

redirect foo.html bar.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top