Skip to content

Instantly share code, notes, and snippets.

@anggadarkprince
Created October 8, 2018 07:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save anggadarkprince/325c7c7081362923104c23ac6995d5a5 to your computer and use it in GitHub Desktop.
Dynamic URL
<?php
if (isset($_SERVER['HTTP_HOST']) && $_SERVER["SCRIPT_NAME"]) {
$root = (isset($_SERVER["HTTPS"]) ? "https://" : "http://") . $_SERVER['HTTP_HOST'];
$root = $root . str_replace(basename($_SERVER["SCRIPT_NAME"]), "", $_SERVER["SCRIPT_NAME"]);
} else {
$root = 'localhost/absent';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment