Ad

Laravel Routes Are Not Working On Live Server

- 1 answer

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', '[email protected]');
Route::get('/group/add', '[email protected]');
Route::get('/group/edit/{id}', '[email protected]');

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

Ad

Answer

Path of Groupcontroller is Controllers/admin/Groupcontroller. So in your routes you need to access Groupcontroller with appropriate path.

Route::get('/group/detail', 'admin\[email protected]');
Route::get('/group/add', 'admin\[email protected]');
Route::get('/group/edit/{id}', 'admin\[email protected]');

Also it is recommended to use CamelCase folder names. that is; change admin => Admin.

Ad
source: stackoverflow.com
Ad