Posted By

neilp123 on 09/28/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

atomicbutterfly


Absolute URL function


 / Published in: PHP
 

  1. // This function defines the Absolute URL
  2.  
  3. function absolute_url($page = 'index.php') {
  4.  
  5. $siteURL = 'http://' .$_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
  6.  
  7. // Remove trailing slashes
  8.  
  9. $siteURL = rtrim($siteURL, '/\\');
  10.  
  11. // Add the page...
  12.  
  13. $siteURL .= '/' . $page;
  14.  
  15. // return the url..
  16.  
  17. return $siteURL;
  18.  
  19. } // End function

Report this snippet  

You need to login to post a comment.