Posted By

o0110o on 10/20/12


Tagged

php path server Website


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

o0110o


Get the absolute webroot URL.


 / Published in: PHP
 

Get the absolute webroot URL.

  1. if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) { define("PROTOCOL", "https://");} // DEFINE PROTOCOL
  2. else { define("PROTOCOL", "http://"); }
  3. define("WEBROOT_URL", PROTOCOL.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])); // DEFINE WEBROOT PATH

Report this snippet  

You need to login to post a comment.