Laravel routing error 404

Viewed 4951

In my laravel project routing isn't working correctly. When I go to /exchange, I get error 404. Redictering works good.

<?php
Route::group(['middleware' => ['web']], function () {

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

Route::get('tos', function() {
    return view('tos');
});
Route::get('contact', function() {
    return view('contact');
});

Route::controller('admin', 'AdminController');

});

And my .htaccess file:

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

What I have to do to repair my project?

2 Answers

You Have To add :-

AllowOverride All to etc/apache2 apache2.conf file

<Directory /usr/share>

AllowOverride All
    Require all granted
</Directory>

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

It will handle routing error.

Related