aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/index.php b/index.php
index b7ed370d..0590b2f6 100644
--- a/index.php
+++ b/index.php
@@ -427,7 +427,11 @@ function serverUrl()
427// (eg. http://sebsauvage.net/links/) 427// (eg. http://sebsauvage.net/links/)
428function indexUrl() 428function indexUrl()
429{ 429{
430 return serverUrl() . ($_SERVER["SCRIPT_NAME"] == '/index.php' ? '/' : $_SERVER["SCRIPT_NAME"]); 430 $scriptname = $_SERVER["SCRIPT_NAME"];
431 // If the script is named 'index.php', we remove it (for better looking URLs,
432 // eg. http://mysite.com/shaarli/?abcde instead of http://mysite.com/shaarli/index.php?abcde)
433 if (endswith($scriptname,'index.php')) $scriptname = substr($scriptname,0,strlen($scriptname)-9);
434 return serverUrl() . $scriptname;
431} 435}
432 436
433// Returns the absolute URL of current script, WITH the query. 437// Returns the absolute URL of current script, WITH the query.