Created
June 1, 2019 04:59
-
-
Save asika32764/6841c14b12e64a469eb46993ef7ea7db to your computer and use it in GitHub Desktop.
Very simple way to get PHP URL path with subfolder.
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 | |
define('APP_ROOT', __DIR__); // Change this to root dir. | |
define('HTTP_TYPE', (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $_SERVER['SERVER_PORT'] === 443 ? 'https' : 'http'); | |
define('HTTP_ROOT', $_SERVER['HTTP_HOST']); | |
define('BASE_URL', HTTP_TYPE . '://' . HTTP_ROOT . substr(APP_ROOT, strlen($_SERVER[ 'DOCUMENT_ROOT' ])) . '/'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment