Created
October 8, 2018 07:40
-
-
Save anggadarkprince/325c7c7081362923104c23ac6995d5a5 to your computer and use it in GitHub Desktop.
Dynamic URL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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