1
votes

i am having troubles with building my route in laravel 4

My routes.php is:
http://paste.laravel.com/v92

When i hit the homepage without a locale in my url it works and goes to the Pagecontroller@showHomepage. When i try to reach it with a locale in my url like en or nl it also works and loads Pagecontroller@showHomepage.

so: / -> works
/nl -> works
/en -> works

Hoever the same thing in the admin group doesnt work. if i try to access the admin route without a locale i get a browser error which stops the loading with a redirect loop error. However with a locale in the url it does work.

so: /admin -> does not work
/nl/admin ->works
/en/admin -> works

What am i doing wrong? I want to be able to go to the admin page without a locale (it loads the default locale)

UPDATED with php artisan routes command: http://paste.laravel.com/v9w

SECOND UPDATE: It has to do with the fact that i have a admin folder in my public folder where i put all the admin related js, css and images. Not sure how to fix this.

2
Do a php artisan routes to see your routes and paste them here if you still have doubts.Antonio Carlos Ribeiro
Hi Antonio, i updated my post with a link to the php artisan routes output.Björn

2 Answers

6
votes

I fixed it myself, it had to do with the fact that i had a /admin/ folder in my public folder with assets like css and images files in it.

I renamed the assets folder to /admin-assets/ and it works again.

0
votes

You might need to add another route to fill the /admin, since the other /admin is inside yor locale group:

Route::group(array('prefix' => 'en'), function()
{
    Route::get('/', 'PageController@showHomepage');

    Route::group(array('prefix' => 'admin'), function()
    {
        Route::get('/', 'AdminPageController@showDashboard');
    });
});

Route::group(array('prefix' => 'admin'), function()
{
    Route::get('/', 'AdminPageController@showDashboard');
});

Those are the routes after this change:

enter image description here