php url formatting question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mrthumbs
    salad tossing sig guy
    • Apr 2002
    • 11702

    #1

    php url formatting question

    www.domain.com
    whatever.domain.com
    domain.com

    Is there a simple php command that
    will strip all the bullshit out
    and return:

    domain.com

    as output?
    Last edited by mrthumbs; 04-24-2003, 03:30 PM.
  • PowerCum
    CjOverkill
    • Apr 2003
    • 1328

    #2
    PHP Code:
    <?php
    
    $myhost="doamin.com";
    
    $host=$_SERVER["HTTP_HOST"];
    $tmp=parse_url($host);
    $scheme=$tmp[scheme]; 
    $path=$tmp[path];
    $query=$tmp[query];
    $host=$tmp[host];
    if ($host!=$myhost){
    $url=($scheme."://".$myhost.$path.$query);
    header("Location: $url");
    }
    
    ?>
    That will redirect all the stuff with no ptoblems

    Hope this will help you
    CjOverkill Traffic Trading Script
    Free, secure and fast traffic trading script. Get your copy now

    Comment

    • mrthumbs
      salad tossing sig guy
      • Apr 2002
      • 11702

      #3
      gracias! Going to test it now!

      Comment

      Working...