Support the ongoing development of Laravel.io →
Configuration
Last updated 2 years ago.
0

Could you share your routes.php file? Thanks.

0

Sure, here they are.


<?php
Route::group(['middleware' => ['web']], function () {
	Route::get('/login', [
		'as'   => 'login',
		'uses' => 'Admin\LoginController@login'
	]);
	Route::post('/login', [
		'as'   => 'post_login',
		'uses' => 'Admin\LoginController@authenticate'
	]);
	Route::group(['prefix' => 'admin', 'namespace' => 'Admin', 'middleware' => 'admin'], function()
	{
		Route::get('/', [
			'as'   => 'admin',
			'uses' => 'DashboardController@show',
		]);
		Route::get('projects', [
			'as'   => 'projects',
			'uses' => 'DashboardController@projects'
		]);
		Route::get('projects/edit/{id?}', [
			'as'   => 'project',
			'uses' => 'DashboardController@editProject'
		]);
		Route::post('projects/edit/{id?}', [
			'as'   => 'project_submit',
			'uses' => 'DashboardController@submitProject'
		]);
		Route::delete('projects/edit/{id?}', [
			'as'   => 'project_delete',
			'uses' => 'DashboardController@deleteProject'
		]);
		Route::get('members', [
			'as'   => 'members',
			'uses' => 'DashboardController@members'
		]);
		Route::get('members/edit/{id?}', [
			'as'   => 'member',
			'uses' => 'DashboardController@editMember'
		]);
		Route::post('members/edit/{id?}', [
			'as'   => 'member_submit',
			'uses' => 'DashboardController@submitMember'
		]);
		Route::delete('members/edit/{id?}', [
			'as'   => 'member_delete',
			'uses' => 'DashboardController@deleteMember'
		]);    
	});
});
/* Frontend routes*/
Route::get('/', [
	'as'   => 'home',
	'uses' => 'FrontEndController@mainPage',
]);
Route::get('/projects/{company}/{projectId?}', [
	'as'   => 'projects_page',
	'uses' => 'FrontEndController@showProjects'
]);

I don't think this is file is the problem. I have all working in my local env. It's in the production server that it happens.

0

I don't see anything off in the routes file.

Can you post the .htaccess?

0

I have managed to solve it. The .htaccess didn't had the permission to rewrite. I had to Allowoverride All for my /var/www directory in the apache2.conf file. Thank you for your answers!

Last updated 8 years ago.
0

No problem, glad you figured it out.

0

Hi all, I had similar problem when the routes and the views were existing and yet there was a page not found on the screen AND then I remembered about routing from Rails. The order of routes is important and they are parsed one after the other and when there is a match the process stops. So in my case I had:

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/companies', 'CompaniesController@index')->name('companies');

Route::get('/companies/{company}', 'CompaniesController@show');

Route::get('/companies/create', 'CompaniesController@create')->name('companies.create');

Route::get('/companies/add','CompaniesController@add')->name('add');

In this case /companies/create and companies/add were not working and page not found was displayed. The problem here is that route 3: Route::get('/companies/{company}', 'CompaniesController@show'); catches companies/add and companies/create as well. SOLUTION: move route 3 to last.

Route::get('/home', 'HomeController@index')->name('home');

Route::get('/companies', 'CompaniesController@index')->name('companies');

Route::get('/companies/create', 'CompaniesController@create')->name('companies.create');

Route::get('/companies/add','CompaniesController@add')->name('add');

Route::get('/companies/{company}', 'CompaniesController@show');

Now everything works because it catches companies/add or companies/create before it reaches the wildcard route.

I hope it helps somebody since in my case this was not in the thread.

Good day :)

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

arquadrado arquadrado Joined 30 Mar 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.