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
Share on other sites

I do not want to use frames, is there any way I can do this with php?

 

Not really. The only thing you could do would be to include the file in question, instead of actually redirecting to it.

Link to comment
Share on other sites

Guest Xanza

I know your question has already been answered, but I speak from experience - their is no way other than using an iframe (and mod_rewrite).. :(

Link to comment
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.