Jump to content

Mask a php redirect ?


jpress07

Recommended Posts

hi guys,

 

Is there a way I can mask a php redirect so once the page has redirected, the new destination URL does not display in the address bar?

 

For example, my page hxxp://mysite.com/affiliate-redirect.php has the following code:

 

<?

 

header( 'Location: hxxp://affiliate-link.html' ) ;

 

?>

 

How do I get hxxp://mysite.com/affiliate-redirect.php to stay displayed in the browser address bar after redirecting to affiliate-link.html?

 

Many thanks for any help!

 

Cheers,

JP

Link to comment
https://forums.phpfreaks.com/topic/109354-mask-a-php-redirect/
Share on other sites

Maybe what you want is a cURL request. That will request the file, then you can print it out. This works badly with

  • Javascript
  • Images
  • Flash

So you'll have to edit the page on the fly a little bit. The hardest part is when the javascript calls SWFObject or write() to add flash. My suggestion?

  • Step one: replace afflicate.com with yoursite.com/get_file_from_other_website
    this redirects all absolute images/flash to your website
  • Step two: do the relative ones somehow
  • Step three: include a javascript file with the functions writeredirect and SWFObjectredirect
  • Step four: replace SWFObject with SWFObjectredirect and write with writeredirect
  • Step five: get_file_from_other_website.php should contain code to request that resource/caching function

Honestly, this is harder than frames

 

Note: Step 1/Step 5 hack will ONLY work on apache servers

Link to comment
https://forums.phpfreaks.com/topic/109354-mask-a-php-redirect/#findComment-561174
Share on other sites

Browsers execuite redirects (the header() statement just tells the browser what address to request), so for an actual redirect the address bar will always show the actual address.

 

The only way you can display your site's address in the address bar would be if you read/include/request the content of the page that you would have redirected to and output it on your page.

Link to comment
https://forums.phpfreaks.com/topic/109354-mask-a-php-redirect/#findComment-561207
Share on other sites

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.