Skip to content

Instantly share code, notes, and snippets.

View serhanozcan's full-sized avatar
🏠
Working from home

Serhan Özcan serhanozcan

🏠
Working from home
View GitHub Profile
<?php
// Get Base URI
$baseUri = str_replace($_SERVER['DOCUMENT_ROOT'], '', dirname($_SERVER['SCRIPT_FILENAME']));
$http = str_replace(array('/', '\\'), '/', $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'] . $baseUri . '/');
$catalog = explode('/', $http);
array_pop($catalog);
array_pop($catalog);
$catalog = implode('/', $catalog) . '/';