In ASP, it works like this:
<%
Response.Redirect "/someurl/"
%>
In PHP, i tried this:
<?php
header("Location: /someurl/");
?>
The problem is that in PHP, the URL in browser's address bar never changes but the page does. Any solution???
| SitePoint Sponsor |



In ASP, it works like this:
<%
Response.Redirect "/someurl/"
%>
In PHP, i tried this:
<?php
header("Location: /someurl/");
?>
The problem is that in PHP, the URL in browser's address bar never changes but the page does. Any solution???
TinyPlanet.org
Discuss and Debate World Events, Politics and Religion.
Interact and Share your Views with People around the Globe.





Try adding the full http:// address of the location not just a relative filename
Please don't PM me with questions.
Use the forums, that is what they are here for.
I don't see that problem at all.
Are you using the PHP file in a frame or something?
My URL changes with either a relative or full URL.
-t



I am testing my site on Windows (Apache, PHP, MySQL). The relative URL just doesn't seem to work.
Okay I'll explain a bit more:
1. I created a template in Dreamweaver.
2. Each page is created from that template.
3. On the top of each page this statement is placed:
This is to enabled buffering.PHP Code:<?php ob_start(); ?>
4. Whenever I have to redirect on any page. I use this:
5. The webpage changes but the URL in the address bar never changes, until i use complete url.PHP Code:ob_end_clean();
header("Location: /url/");
exit;
6. This method always works in ASP.
TinyPlanet.org
Discuss and Debate World Events, Politics and Religion.
Interact and Share your Views with People around the Globe.



Yes, to add something. I DO NOT want to use complete URLs with http://.
TinyPlanet.org
Discuss and Debate World Events, Politics and Religion.
Interact and Share your Views with People around the Globe.
Then use javascript redirect, not sure if this is correct I am not very good in JS
Something like:
<script language="javascript">
window.top.location="/myfile.php";
</script>
Edit: There is also option to use Meta refresh tag:
<meta http-equiv="refresh" content="2;URL=/myfile.php">
2 is number of seconds, you can replace that with 0 or any bigger number.
Good luck!
Last edited by moshe_be; May 4, 2001 at 00:30.



No, I dont want to do it this way. Thanks anyway. I think I'll have to use complete URLs (including http).![]()
TinyPlanet.org
Discuss and Debate World Events, Politics and Religion.
Interact and Share your Views with People around the Globe.





Or it might just be a problem with the Windows implementation of PHP that could be solved by uploading to your host - try uploading it and see if that helps.
Bookmarks