Open codazoda opened 10 years ago
Hello. I can confirm this issue as well. removing the last else block (18 line) resolves it, but not sure if it won't cause trouble is some other situation...
I have this problem too!
@sijad @kutchbhi You have several options how to fix it I'm using this: Toro.php
$uri = @explode('/', $_SERVER['REQUEST_URI'])[2]; //Here you need to find your dir or use GET
$path_info = ((!empty($uri)) ? $path_info = '/'.$uri : $path_info = '/');
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
IndexIgnore */*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*) index.php [L,QSA]
</IfModule>
If I access the index.php that includes Toro.php from a URL with no path it works fine. Here's an example:
If, however, I access an index.php file that is inside of a directory or two, it fails. Here's an example of that (my index is in /var/www/some/directory/index.php).
What I've found is that the last test in Toro.php that looks at the $_SERVER['REQUEST_URI'] is the problem. That variable returns "/some/directory/" in the case of my script being setup inside a directory. As a result the "/" route fails to work, but the others do work. Here's the failing route code.
If I change the code to the following, it works.
By removing the last for $_SERVER['REQUEST_URI']) the problem goes away (because '/' is the default $path_info value).
So, my question is, what does that last $_SERVER['REQUEST_URI'] add that I'm missing here? Should it be removed or put in as an option? If so, I'm happy to make these changes and submit a pull request.