Loading...
 
Skip to main content

Trailing backslash at domain in URLs when installed in DocumentRoot

Status
Closed
Subject
Trailing backslash at domain in URLs when installed in DocumentRoot
Version
2.x
3.x
4.x
Category
  • Error
  • Patch
Feature
All / Undefined
Installer (profiles, upgrades and server-related issues)
Infrastructure
OS independence (Non-Linux, Windows/IIS, Mac, BSD)
Submitted by
stefricht
Volunteered to solve
Philippe Cloutier
Lastmod by
Philippe Cloutier
Rating
(0)
Description

In my installation, on some internal links that are represented in an absolute way, there is a backslash between the domain name and the first slash.

Eg when I try to login on http://mydomain.com/index.php, I get redirected to http://mydomain.com\/tiki-login.php, which the server cannot render.

Clean install of:
MS Windows Server 2003 SE SP2 on x86
Apache 2.2.10
MySQL 5.1.30
PHP 5.2.8
TikiWiki 2.2

Tiki resides directly in the DocumentRoot C:\tiki (as it is a dedicated server).

In tiki-setup.php, there is a line

Image
Copy to clipboard
$tikiroot = dirname($_SERVER['PHP_SELF']);


In the documentation of dirname, they state that since PHP 4.3.0, dirname returns unexpected values. The example implies that on Windows dirname('/x') returns '\'.

Therefore, if you install Tiki in the DocumentRoot, _SERVER'PHP_SELF' will be '/filename.php' and $tikiroot will be '\'.

Solution
Fixed for Tiki 5 in r27191.
Workaround

Since this seems to be the only special case, adding

Image
Copy to clipboard
if ($tikiroot == '\\\\') $tikiroot = '/';


somewhere appropriate, eg before

Image
Copy to clipboard
if ( substr($tikiroot,-1,1) != '/' ) $tikiroot .= '/';


works for me. Otherwise, a regex should help. However, I'm not too familiar with Tiki's source; maybe there are other places.

Importance
1 low
Priority
5
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
2224
Created
Monday 15 December, 2008 14:15:17 UTC
by Unknown
LastModif
Tuesday 25 May, 2010 05:41:59 UTC


Show PHP error messages