Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion libraries/src/Uri/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ public static function getInstance($uri = 'SERVER')
*
* IIS uses the SCRIPT_NAME variable instead of a REQUEST_URI variable... thanks, MS
*/
$theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $_SERVER['SCRIPT_NAME'];
$slash = '';
if (substr($_SERVER['SCRIPT_NAME'], 0, 1) !== '/' && substr($_SERVER['HTTP_HOST'], -1) !== '/') {
$slash = '/';
}
$theURI = 'http' . $https . $_SERVER['HTTP_HOST'] . $slash . $_SERVER['SCRIPT_NAME'];

// If the query string exists append it to the URI string
if (isset($_SERVER['QUERY_STRING']) && !empty($_SERVER['QUERY_STRING'])) {
Expand Down