Anyone knows how to make laravel work in a subfolder specifically when posting a form on the same page?
Route::get('/','HomeController@getIndex');
Route::post('/','HomeController@postIndex');
Ex form URL: http://localhost/laravel. Alias added on apache. ...Alias /laravel /www/laravel/public
When you submit the form on this page, the route does not catch it and just return the index page.
However, when you specify index.php on url or add a trailing slash on form action (http://localhost/laravel/), routes catches the post event. It will also work when you specify other url in action like ...array('url' => 'post-index')
All works well when I use virtual host, but my requirements is to install the app in subfolder. Tried playing on htaccess but had no luck.
How did you open the form tag?
I think this should work
{{ Form::open(['action' => 'HomeController@postIndex']) }}
Just change/create a different post URL as a work around. Reported as BUG
Not working route:
Route::post('/', 'HomeController@postIndex');
{{Form::open(array('class'=>'form-horizontal validate','action'=>'HomeController@postIndex' ))}}
Form will work if you change the route below.
Route::post('post-index', 'HomeController@postIndex');
This solution:
Form will work if you change the route below.
Route::post('post-index', 'HomeController@postIndex');
forks fine, thanks!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community