Home > Software design >  why it show 404 error in laravel login page in ubuntu cloud server?
why it show 404 error in laravel login page in ubuntu cloud server?

Time:06-09

i have installed fresh laravel and laravel auth/ui on my server and configure the vhost and .htaccess file , it display welcome page but when i click on login or register link in welcome page it show 404 error below are the .htaccess and vhost code.

.htaccess code     
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase //
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ index.php?$1 [L]
    </IfModule>

and here is the 000-default.conf code

<VirtualHost *:80>
DocumentRoot /var/www/html/myproject/public
ServerName example.test
<Directory "/var/www/html/public">
    allow from all
    Options None
    Require all granted
</Directory>
    Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Route::middleware('auth')->group(function () {
    Route::view('about', 'about')->name('about');

    Route::get('users', [\App\Http\Controllers\UserController::class, 'index'])->name('users.index');

    Route::get('profile', [\App\Http\Controllers\ProfileController::class, 'show'])->name('profile.show');
    Route::put('profile', [\App\Http\Controllers\ProfileController::class, 'update'])->name('profile.update');
});

Route::get('/home', [App\Http\Controllers\HomeController::class, 'index'])->name('home');

Auth::routes();

CodePudding user response:

Please change your apache2 configuration:

<VirtualHost *:80>
DocumentRoot /var/www/html/myproject/public
ServerName example.test
<Directory /var/www/html/myproject/public>
    Options FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>
  • Related