Get Base URL...

Discussion in 'PHP' started by timallard, Jul 14, 2009.

  1. #1
    Hello,

    I'm trying to get part of my url to store as a var to redirect to..but im having trouble... i just dont want it to include any value pairs..

    e.g. www.example.com/page.php?var1=val1

    how can i just get www.example.com/page.php part.

    im trying to have it redirect to the same page (the page the user is on), minus the value pairs..


    thanks!!!!
     
    timallard, Jul 14, 2009 IP
  2. Goramba

    Goramba Peon

    Messages:
    128
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $current="http://".$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
     
    Goramba, Jul 14, 2009 IP
    timallard and baris22 like this.
  3. timallard

    timallard Well-Known Member

    Messages:
    1,634
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    158
    #3
    worked like a charm. thank you. +rep
     
    timallard, Jul 15, 2009 IP
  4. dgroom

    dgroom Guest

    Best Answers:
    0
    #4
    Thanks, I will find this useful also!
     
    dgroom, Jul 15, 2009 IP