CodeIgniter Forums

Full Version: Bug in URI Class since 2.0.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Unknown[/eluser]
Hi,

I've found a bug in the URI-Class since 2.0.1. Im using a subfolder in controllers for my backoffice-controllers, rewriting all requests from backoffice.domain.tld to /backoffice/$1 using:

Code:
RewriteCond %{HTTP_HOST} ^backoffice\.domain\.tld
RewriteCond %{REQUEST_URI} !^/backoffice
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /backoffice/$1 [L]

However since 2.0.1 this will not load the /backoffice/default_controller-controller, it will instead load the root default_controller. When i debugged the code i found out that $uri is empty for my request to backoffice.domain.tld and if it was kept empty it worked, but not if a second trailing slash was added like the way in 2.0.1 and 2.0.2:

Code:
if ($uri == '/' || empty($uri))
{
  return '/';
}

This fixes the problem:

Code:
if ($uri == '/')
{
  return '/';
}
        
if (empty($uri))
{
  return '';
}

The second trailing slash might not be working because of my setup (Apache2.2.17 on OSX) but still, if anyone have the same problem this fix works.

El Forum

[eluser]RJ[/eluser]
You should add the bug to bitbucket if you havent already.