Forum Moderators: coopster

Message Too Old, No Replies

index.php

redirect index.php to index.php?page=new

         

christ1986

3:27 am on Jul 29, 2005 (gmt 0)

10+ Year Member



hi,
the problem i'm getting here is with my index.php
below is the content of it:

if($_GET['page'] == "new") {
include("new.php");
} else {
print $content;
}

my default page is set to index.php?page=new

but in case someone enter the url index.php i need to redirect them to my default page...
tried redirect using .htaccess but the one i know doesn't load up right too...
apparently there is some problem in recognising '?',
i tried to include my default page content into the index.php, but some thing just doesn't load up right...

please help me....
please...
and thank you in advance...
i'm a noob in this field...

maxi million

5:11 am on Jul 29, 2005 (gmt 0)

10+ Year Member



how about doing this:

if($_GET['page'] == "new") {
include("new.php");
} else {
header ("Location: http://www.example.com/index.php?page=new");
}

for this to work error free you might need to add this on top of index.php:
ob_start();

christ1986

6:00 am on Jul 29, 2005 (gmt 0)

10+ Year Member



Thanks Max,
this works just fine...

Really stupid me...
the answer is pretty obvious huh...
y can't i think of tat in the first place...