SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Evangelist Umair.ms's Avatar
    Join Date
    Sep 2000
    Location
    Lahore, Pakistan
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Evangelist thewitt's Avatar
    Join Date
    Apr 2001
    Posts
    468
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Evangelist Umair.ms's Avatar
    Join Date
    Sep 2000
    Location
    Lahore, Pakistan
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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:
    PHP Code:
    <?php ob_start(); ?>
    This is to enabled buffering.
    4. Whenever I have to redirect on any page. I use this:
    PHP Code:
    ob_end_clean();
    header("Location: /url/");
    exit; 
    5. The webpage changes but the URL in the address bar never changes, until i use complete url.
    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.

  5. #5
    SitePoint Evangelist Umair.ms's Avatar
    Join Date
    Sep 2000
    Location
    Lahore, Pakistan
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    SitePoint Zealot moshe_be's Avatar
    Join Date
    Dec 2000
    Posts
    169
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 3, 2001 at 23:30.

  7. #7
    SitePoint Evangelist Umair.ms's Avatar
    Join Date
    Sep 2000
    Location
    Lahore, Pakistan
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  8. #8
    SitePoint Wizard
    Join Date
    Apr 2000
    Posts
    1,483
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •