Bug Report #2956

Route::$uri does not respect base_url and index_file

Added by Dmitry T. over 4 years ago. Updated over 4 years ago.

Status:ClosedStart date:06/12/2010
Priority:NormalDue date:
Assignee:Woody Gilk% Done:

0%

Category:Core
Target version:v3.0.7
Resolution:invalid Points:

Description

Route::set('admin', 'admin(/<controller>(/<action>(/<param1>(/<param2>))))')
    ->defaults(array(
        'directory'  => 'admin',
        'controller' => 'index',
    ));

...

echo Route::get('admin')->uri(array('controller' => 'manage', 'action' => 'posts'));

base_url is set to "/" and index_file to "index.php"

Expecting: /index.php/admin/manage/posts (note the forward slash)
Result: admin/manage/posts

base_url is set to "/some/" and index_file to FALSE

Expecting: /some/admin/manage/posts (note the forward slash)
Result: admin/manage/posts

History

#1 Updated by Dmitry T. over 4 years ago

Sorry, not Route::$uri, but Route::uri()

#2 Updated by Dmitry T. over 4 years ago

I got it. I should use URL::site(Route::get('admin')->uri(array('controller' => 'manage', 'action' => 'posts')));

#3 Updated by Woody Gilk over 4 years ago

  • Status changed from New to Closed
  • Resolution set to invalid

Correct, Routes are not aware of the base URL and index settings, only the URL helper is.

Also available in: Atom PDF