Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel routes are not working on live server

I just found the problem on server. all is working fine in my localhost, but on live server, ONLY the home page route is working.

My directory is:

laravel-
        css
        js
        local->
             app
                 HTTP->
                      Controllers->
                                Homecontroller
                                 admin->
                                        Groupcontroller   
             config
              ...

Here is my htacess

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
RewriteCond %{HTTP:Authorization} ^(.+)$
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

And my route file is:-

Route::get('/group/detail', 'Groupcontroller@index');
Route::get('/group/add', 'Groupcontroller@create');
Route::get('/group/edit/{id}', 'Groupcontroller@edit');

http://www.example.com/home

My home controller is working.I think issue is with admin folder???

http://www.example.com/admin/group/detail

This is not working

Error is encountered :-

Class App\Http\Controllers\Admin\Groupcontroller does not exist

Please help me,Working fine at localhost but not on live. Thanks in advance

like image 434
diksha Avatar asked Jan 12 '16 05:01

diksha


People also ask

What is the difference between web and API routes in Laravel?

In a Laravel application, you will define your “web” routes in routes/web. php and your “API” routes in routes/api. php. Web routes are those that will be visited by your end users; API routes are those for your API, if you have one.

What is default route in Laravel?

The Default Route Files The routes/web.php file defines routes that are for your web interface. These routes are assigned the web middleware group, which provides features like session state and CSRF protection. The routes in routes/api.php are stateless and are assigned the api middleware group.


1 Answers

Try and change the content of your .htacess to this

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

    RewriteEngine On

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

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

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
like image 62
TheLastCodeBender Avatar answered Oct 26 '22 05:10

TheLastCodeBender