There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display driver drivers email error excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware network networking outlook outlook 2003 outlook express partition password printer problem ram router slow software sound sprtcmd.exe trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Redirection!!??


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
bhilai.co.in's Avatar
Computer Specs
Junior Member with 20 posts.
 
Join Date: Oct 2006
Location: Bhilai, India
Experience: Intermediate
11-Nov-2006, 12:55 AM #1
Redirection!!??
Hey friends,
i have a website, and i want that if any user click
any link, a comman page would apear for all links for 10 seconds,
and it auto redirect to the particular link, the user click on.
I need two types of code:
1>a code for every link where the 10 sec page will b comman,
2>a comman code for all links on website where also the 10 sec page would b comman.
thanks in advance!!
Have a great day!!
knight_47's Avatar
Senior Member with 1,187 posts.
 
Join Date: Mar 2006
Location: →
Experience: Um... Green?!
11-Nov-2006, 02:31 AM #2
I couden't really understand what you were trying to say, but this is the redirect code:

Place this code somewhere in between the <head> </head> tags.

Code:
<meta HTTP-EQUIV="REFRESH" content="10; url=http://www.yourdomain.com/index.html">
bhilai.co.in's Avatar
Computer Specs
Junior Member with 20 posts.
 
Join Date: Oct 2006
Location: Bhilai, India
Experience: Intermediate
11-Nov-2006, 03:00 AM #3
ok. im sory, i cant explain clearly.bad english na
let me try once more.....
suppose in my homepage there r 4 different links to another pages say i.e A, B, C ,D.
and 1 more page, say 'X'
now i need a simple code which i put on my homepage and
when any1 click on A/B/C/D it will 1st go through from page 'X' after 10 seconda it will redirect to the page a user want to see.

Destination page may be different,
bt before reaching any page user have to cross the page 'X' for 10 seconds.
---------Code??
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,197 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
11-Nov-2006, 06:43 AM #4
I can only think of two options.
One would be (if you had 4 links) to make 4 pages, each with a different redirect code for the different page to redirect to.
The other would be to use one page, with a lot of IF/ELSE php statements in it for the different links. Like "if link A was clicked, use the redirect code for page A".

Or something like that.....

It might just be easier to make a few pages, each with a different redirecting code in it. Like for example this:

<a href="pageAredirect.html">Page A</a>
<a href="pageBredirect.html">Page B</a>
<a href="pageCredirect.html">Page C</a>

code for page A
<meta HTTP-EQUIV="REFRESH" content="10; url=http://www.yourdomain.com/pageA.html">

code for page B
<meta HTTP-EQUIV="REFRESH" content="10; url=http://www.yourdomain.com/pageB.html">

code for page C
<meta HTTP-EQUIV="REFRESH" content="10; url=http://www.yourdomain.com/pageC.html">
__________________
-----------------------------
| 404: Name Not Found |
-----------------------------
PLEASE NOTE: If I happen to help you in a post, or just simply reply to it, doesn't mean I want to be bombarded with PMs. I answer all questions in posts, not in PMs. Thank you, and have a good day.

<?php $h = 'Hello '; $w = 'World'; echo $h.$w; ?>

My Favorite Editors:
Windows: Crimson Editor
Mac: Taco HTML Edit
Linux: gPHPEdit
DrP's Avatar
DrP DrP is offline
Senior Member with 481 posts.
 
Join Date: Jul 2005
Location: UK
Experience: What's a compoota?
11-Nov-2006, 02:26 PM #5
You could do it in PHP without using IF statements if you pass a redirect variable through the url and get the redirect page to use that...
Eriksrocks's Avatar
Computer Specs
Senior Member with 1,859 posts.
 
Join Date: Aug 2005
Location: Minnesota
Experience: Advanced
11-Nov-2006, 09:11 PM #6
Quote:
Originally Posted by DrP
You could do it in PHP without using IF statements if you pass a redirect variable through the url and get the redirect page to use that...
That's what I was thinking, so you would only need one redirect page and then just pass the destination through a variable, very easy.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,197 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
11-Nov-2006, 09:49 PM #7
You could also do it with switches (since you don't like my if/else idea)

then have the links be something like redirect.php?go=page1 have it go to the redirect page, then to the intended page
bhilai.co.in's Avatar
Computer Specs
Junior Member with 20 posts.
 
Join Date: Oct 2006
Location: Bhilai, India
Experience: Intermediate
12-Nov-2006, 03:00 AM #8
thanx guys.
bt i dont know abt PHP.
pls help me out for the PHP code.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,197 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
12-Nov-2006, 06:43 AM #9
Quote:
Originally Posted by bhilai.co.in
thanx guys.
bt i dont know abt PHP.
pls help me out for the PHP code.
Well if you wanted to use switches, you could do something like


PHP Code:
<html>
<head>
<title>Redirection Portal</title>
<?php
switch ($_GET['go']):
  case 
"pageA":
  echo 
"<meta HTTP-EQUIV="REFRESH" content="10url=http://www.yourdomain.com/pageA.html">";
  
break;
    case 
"pageB":
    echo 
"<meta HTTP-EQUIV="REFRESH" content="10url=http://www.yourdomain.com/pageB.html">";
    
break;
  case 
"pageC":
  echo 
"<meta HTTP-EQUIV="REFRESH" content="10url=http://www.yourdomain.com/pageC.html">";
  
break;
      case 
"pageD":
      echo 
"<meta HTTP-EQUIV="REFRESH" content="10url=http://www.yourdomain.com/pageD.html">";
      
break;
default:
echo 
"Unknown redirection";
endswitch;
?>
</head>
<body>
<h1>Your redirection will begin in 10 seconds</h1>
(Whatever else you want to add
This is the general redirection page that all the links will share
the only difference is the <meta> tag we just entered
in the PHP that says where we redirect to)
</body>
</html>
Let's say you saved that as links.php then in your links, you add links.php?go=pageA (or whatever letter)

<a href="links.php?go=pageC">Go to page C</a>

Last edited by namenotfound : 12-Nov-2006 06:49 AM.
bhilai.co.in's Avatar
Computer Specs
Junior Member with 20 posts.
 
Join Date: Oct 2006
Location: Bhilai, India
Experience: Intermediate
12-Nov-2006, 07:29 AM #10
Thanx yaar
but i need any single code with a single page
to redirect to all my links
pls help
im sory icant explain properly

Last edited by bhilai.co.in : 12-Nov-2006 07:42 AM.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,197 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
12-Nov-2006, 10:08 AM #11
I just realized I messed up on the quotes. (I had conflicting quotes in the code).

Replace the php block with this


<?php
switch ($_GET['go']):
case "pageA":
echo "<meta HTTP-EQUIV='REFRESH' content='"10; url=http://www.yourdomain.com/pageA.html'>";
break;
case "pageB":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageB.htm'>";
break;
case "pageC":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageC.html'>";
break;
case "pageD":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageD.html'>";
break;
default:
echo "Unknown redirection";
endswitch;
?>

Sorry about that, hopefully you figured it out on your own so you didn't get an error message


Quote:
but i need any single code with a single page
to redirect to all my links
This is a single page. Just add new cases as needed
Every link will go to this one single redirection page, then after 10 seconds will go to the intended page.
__________________
-----------------------------
| 404: Name Not Found |
-----------------------------
PLEASE NOTE: If I happen to help you in a post, or just simply reply to it, doesn't mean I want to be bombarded with PMs. I answer all questions in posts, not in PMs. Thank you, and have a good day.

<?php $h = 'Hello '; $w = 'World'; echo $h.$w; ?>

My Favorite Editors:
Windows: Crimson Editor
Mac: Taco HTML Edit
Linux: gPHPEdit
Eriksrocks's Avatar
Computer Specs
Senior Member with 1,859 posts.
 
Join Date: Aug 2005
Location: Minnesota
Experience: Advanced
12-Nov-2006, 10:43 AM #12
Actually it should be replaced with this:

<?php
switch ($_GET['go']):
case "pageA":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageA.html'>";
break;
case "pageB":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageB.htm'>";
break;
case "pageC":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageC.html'>";
break;
case "pageD":
echo "<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/pageD.html'>";
break;
default:
echo "Unknown redirection";
endswitch;
?>

You had '" instead of ' at the top in red.
Eriksrocks's Avatar
Computer Specs
Senior Member with 1,859 posts.
 
Join Date: Aug 2005
Location: Minnesota
Experience: Advanced
12-Nov-2006, 10:54 AM #13
Well actually I just thought of a better way to do it so you don't need to add a case for each page.

PHP Code:
<?php

if( $_GET['go'] != null )
{
$location $_GET['go'] . ".html";
}

echo( 
"<meta HTTP-EQUIV='REFRESH' content='10; url=http://www.yourdomain.com/" $location "'>";

?>
Just dynamically takes go and adds .html to the end and then redirects to that page in 10 seconds. So if you had links.php?go=mypage then it would redirect to http://www.yourdomain.com/mypage.html.

If you wanted to have it redirect to /folder/page.html you could have it like this:
links.php?go=folder/page.html
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,197 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
12-Nov-2006, 11:22 AM #14
Quote:
Originally Posted by Eriksrocks
Actually it should be replaced with this:

You had '" instead of ' at the top in red.
*hits head* I'm making a lot of mistakes today
Thanks Erik for pointing that out
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
12-Nov-2006, 02:23 PM #15
Quote:
Originally Posted by Eriksrocks
Well actually I just thought of a better way to do it so you don't need to add a case for each page.
Be careful using that if your site stores passwords in cookies or anything like that, as it would be open to cross-site scripting.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 12:37 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.