I want to change the URL through PHP.
Something like window.location.href = "//www.something.com"
in JavaScript.
I want the same thing but in PHP. How can I do it?
asked May 4, 2010 at 9:57
1
You can use the header
function for that:
header["LOCATION: //www.something.com"];
answered May 4, 2010 at 9:59
SarfrazSarfraz
371k73 gold badges529 silver badges574 bronze badges
0
You could use the header[] command:
answered May 4, 2010 at 10:00
richsagerichsage
26.7k8 gold badges57 silver badges65 bronze badges
Make sure there is nothing above the line outputted, otherwise it will fail.
TimWolla
30.9k8 gold badges64 silver badges94 bronze badges
answered May 4, 2010 at 10:00
GlycerineGlycerine
6,8543 gold badges38 silver badges63 bronze badges
1
You could use ob_start along with the header function in order to prevent redirection errors like so: