aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorSébastien SAUVAGE <sebsauvage@sebsauvage.net>2013-02-27 16:52:32 +0100
committerSébastien SAUVAGE <sebsauvage@sebsauvage.net>2013-02-27 16:52:32 +0100
commit9e975d86e4d1b915b2bc87251a13f3467508ac9a (patch)
tree735e385253b3d28a273109a9b345799800dab839
parent2abd39052da6f5b050bb29232548f17c2ea7e2ee (diff)
downloadShaarli-9e975d86e4d1b915b2bc87251a13f3467508ac9a.tar.gz
Shaarli-9e975d86e4d1b915b2bc87251a13f3467508ac9a.tar.zst
Shaarli-9e975d86e4d1b915b2bc87251a13f3467508ac9a.zip
Remove script name from URL if it's index.php
(for better looking URLs, eg. http://mysite.com/shaarli/?abcde instead of http://mysite.com/shaarli/index.php?abcde)
-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.