Hi, I need to redirect to dynamic url, this url is passed as parameter, like this:

	$origen=$_GET['xorigen'];
       header("Location: http://localhost/nomina/" .$origen);	

But it doesn't work, the error I got is 404

also I tried with
header("Location: $origen");

but still I got the error

my question is:
how should I pass the $origen var to header() function to redirect dynamically?

all the best

    I think your code is good.
    It should work

    $origen=$_GET['xorigen'];
    header("Location: http://localhost/nomina/" .$origen); 

    Suppose you have one page:
    maria.php inside folder /nomina/
    then
    if the above code is inside 'dynamic.php' in web root folder

    http://localhost/dynamic.php?xorigen=maria.php
    should load correct page

      What URL are you being redirected to? Try changing 'header(' to 'echo ' so you can visually examine the string being used with the header() function. Perhaps $origen isn't being set properly (or to what you think it should be)?

        Write a Reply...