Hi everyone,

Is there any way to redirect page without header and javascript ?

Via a .htaccess file:
Redirect 301 /oldpage.html http://www.example.com/newpage.html

I've used 301 in this example. but this can also be 302. The difference is that a 301 redirect means that the page has moved to a new location, permanently. A 302 redirect means that the move is temporary.

i have 3 page

first page(x) redirect me to second page(y) and when i do some action from second page and my third page i called actions.php and that action i did from page y it go to actions.php. From action php should automatocally redirct to my second page (y).

page x o first page is like this ...

    $item_query=mysql_query("SELECT * FROM items ") or die(mysql_error());
        echo "<br/>";
        echo "<a href='product.php?product=$userid'>$username</a>";

this is my 2° page...

if(isset($_GET['product'] ) && !empty($_GET['product'])){
    $itemid= $_SESSION['item_id'];
$Item_query=mysql_query("SELECT * FROM item WHERE item_id=$itemid") or die( mysql_error());
while($run_item= mysql_fetch_array($mem_query)){
    echo '<h3> Your Name: '.$name."<br/>ID: ".$meid.'</h3>';
            $sendquery=mysql_query("SELECT fid FROM order WHERE inorder= $itemid AND userid= $my_id ")or die (mysql_error());

                    echo "<a href='actions.php?action=send&product=$itemid'> Send Reqeust </a>";
    mysql_query("INSERT INTO order VALUES ('','$my_id','$userid')");


My PHP skills are very limited, so you'll have to wait for someone else to jump in :)


in this case you can use header(), you could setup actions.php like an hub and define specific redirect links:

    case 'send':

        # run insert query
        $redirectTo = "http://website.tld/pageY.php";

    case 'update':

        # run code here
        $redirectTo = "http://website.tld/pageX.php";


        $redirectTo = "http://website.tld/pageA.php";

header("Location: $redirectTo");

Also when using single quotes, PHP will not parse the variable, so:


Will literally output items.php?item=$itemid, not items.php?item=17 as expected. You have to use double quotes:

header("Location: http://website.tld/items.php?item=$itemid");