View Full Version : redirecting based on time... but it does the WHOLE folder..

12-02-2005, 10:42 AM
I am using this code:

header("location: /folder/index2.php")

What I am looking for though is basically a one page redirection. Try to explain:

If user goes to /folder/index.php between 12 and 4 they are auto redirected to /folder/index2.php which is perfect, and this works.

However, if user goes to /folder/page1.php they are STILL auto redirected to /folder/index2.php

What I want is to ONLY redirect to /folder/index2.php IF they go to the index, but no redirect if they go to any other page in that folder.

How can I do this?


12-02-2005, 11:05 AM
What do you mean? Where are you using this code? In index.php? In page1.php?

12-02-2005, 11:07 AM
The code is on index.php to redirect to index2.php

but if user goes to page1.php they still get redirected to index2.php I just want the time redirection to happen to index.php to index2.php if they bypass index.php through the URL then I don't want ANY redirection.


OH FOR CRYING OUT LOUD.... never mind me, I am a dumb ass... I had the stupid redirect code set for 8 instead of 4 AND I had it on ALL the pages in that folder... NO WONDER!!! jeez, sometimes I am amazed I can even breathe.

06-13-2006, 02:40 PM
I need help with this once again....

As you can see by the OP this has been up and working for some time.

I have the code on the index page in a sub folder so structure looks like this:


It should be redirecting to:

http://sub.main.com/folder/subfolder/page1.php IF the user goes to index page between midnight and 8 a.m. (servertime)

All of a sudden I am getting the "headers already sent" error showing on the page... (still Twey, I know you tried to help with this already through a PM)

I DO NOT have ANY white space before the <?php and no extra spaces ANYWHERE.

I have even tried using the ob_start(); flush thing, and even that didn't work

ANY ideas? I am at wits end here!


06-21-2006, 07:49 AM
Lil bumpity... :D

06-21-2006, 04:51 PM

06-25-2006, 07:14 AM
Eh, sorry for the delay in replying.. However, I did find the problem. There was an error in the virtualhost index .... don't ask... something on the server.

So my code was right all along. Explains the sudden halt to a working script.

Either way it is back and working now!! Happy Day!