Jump to content

Double header (Location)


ozestretch

Recommended Posts

What are the issues with setting up something like this?

 

page1.php

<?php
header('Location: http://www.phpfreaks.com/');
// meta refresh, html link down here as backup
?>

 

page2.php

<?php
header('Location: page1.php');
// meta refresh, html link down here as backup
?>

 

I realise that by itself seems usless.

 

But what if page1.php is on a different domain, that happens to be a redirect page and I only control the page2.php

 

 

Scenario:

URL mask(shortner) script I have on site A uses header('Location: ....') plus a backup of meta refresh and an actual link just incase

 

But a URL gets shortened that is redirected similarly

 

I get a header output message for a moment when I do this, but meta kicks in and takes it to 'http://www.phpfreaks.com/' anyways

Link to comment
Share on other sites

After looking again, I can't see why the whitespace/header already outputted error persists in this situation

 

except I just went to get the code, and that HDD is not plugged in  :-[ (just spent last 5 hours fixing a MBR / NTLDR error)

 

well spent 30 minutes fixing, 4 1/2 hours working out the what / why and how's  :'(

 

In my code above, should that cause header already outputted notice? (my actual code in page2.php contains more than that header redirect but I can't see how that causes the error when at page1.php) but when testing with redirecting to page1.php (like I have above) it outputs notice.

Link to comment
Share on other sites

you can't output anything before using header(). what is the rest of the code for page2.php?

 

Mysql query(or queries - can't remember), but no output. (once my main pc is working again, I can access the code)

 

Was my understanding that if there was output before header, the redirect would not work? If that is the case, def no output as it does redirect. (works a charm if page2.php location = http://www.phpfreaks.com [or a page that is not causing a header redirect])

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.