Syed Abdur Rehman Kazmi
Syed Abdur Rehman Kazmi

Reputation: 1647

Laravel route 404 error AWS

Hi i am newbie when it comes to AWS. I have deployed my first app on cloud and and everything else works fine except that i am getting this weird error of route not found when clearly i have added the routes and they work fine on my local machine.. The weird thing is the home route which takes you to laravel home works perfectly but the others doesnt seem to work..

This is my route file

     <?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});


Route::post('/pusher/auth', 'Api\v1\TestController@index');


Route::get('/test' , function (){
    dd(\Config::get('constants.front_end.baseUrl').\Config::get('constants.front_end.change_password').'?token=token_value&email=email_value');
});


Route::get('user/code' , 'Api\v1\UserController@code')->name('user/code');
Route::get('user/change_password' , 'Api\v1\UserController@changePassword')->name('user/change_password');

This is where i have set AllowOverride for it

<Directory />
        Options FollowSymLinks
        AllowOverride none
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride none
        Require all granted
</Directory>

<Directory /var/www/html/FinlinkWeb/backend/public/>
        AllowOverride All
        Require all granted
</Directory>

<Directory /var/www/html/>
        AllowOverride All
        Require all granted
</Directory>

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

`

The first one works fine but the other doesnt seem to work and throw a 404 error..

I have checked all routes on my local machine and all the controllers too. everything works fine. but not on AWS.

Upvotes: 1

Views: 1466

Answers (1)

Vishwa
Vishwa

Reputation: 506

Try this. i also got this issue and searched a lot. finally found this solution and it worked for me.

  1. change your 000-default.conf file as follows,

    enter image description here

  2. sudo a2enmod rewrite

  3. sudo systemctl restart apache2

Upvotes: 2

Related Questions