Jump to content

how to redirect from one page to another?


ivytony

Recommended Posts

I don't really know how to phrase my question better,  so let's put it this way: ;)

 

I have a cloaked affiliate link, say something like this http://www.mywebsite.com/affiliate_id=1000 for this actual affiliate link  http://www.merchant1.com/index.php?affiliate=1000.

 

A deal info is posted for this product: http://www.merchant1.com/categories/subcategories/products/hot/products1.html. When users click on this product link, I'd like them to be directed to http://www.merchant1.com/index.php?affiliate=1000 (through my cloaked link?) first so that my affiliate ID can be transmitted to the merchant. A few seconds later, the user will be redirected to the above product link for them to make purchases. I am wondering how I can do this in PHP?

 

I'm not sure if I make myself understood  ???

 

Thanks!!!

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/87868-how-to-redirect-from-one-page-to-another/
Share on other sites

But I think one more question for you:

<?php

header("Location: http://www.merchant1.com/index.php?affiliate=1000");
sleep(6); // will pause for 6 seconds before continuing
header("location: http://www.merchant1.com/categories/subcategories/products/hot/products1.html");

?>

 

I have this above code in my redirection controller, I am wondering if it's correct. Because I can only see the products page without showing the merchant front page. Is this correct?

 

thanks again!

No, php will finish processing the code before it redirects.  So once it redirects it doesn't know to finish processing the code.  In other words you can't do two redirects from the same script.  You'd need to redirect to a page, and from that page redirect again, or show the affiliate in an iframe or something so you can redirect the parent page.

If the intermediate pages are on yer site, u can use something like

html meta refresh tag

 

providing u with the timeout u need as well as the redirect.

 

however if the pages in question are not on yer site. you may have to use frames and some javascript.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.