diff options
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -427,7 +427,11 @@ function serverUrl() | |||
427 | // (eg. http://sebsauvage.net/links/) | 427 | // (eg. http://sebsauvage.net/links/) |
428 | function indexUrl() | 428 | function 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. |