Search code examples
laravellaravel-5.3laravel-5.4

Inner Urls not working on Linode


I have below two routes

Route::get('register', 
    array(
        'uses' =>  'Auth\Register\RegisterController@showRegistrationForm', 
        'as'   =>  'showRegistrationForm'
    )
);

Route::get('/', 
    array(
        'uses' =>  'Auth\Login\LoginController@showLoginForm', 
        'as'   =>  'showLoginForm'
    )
);

Both routes works perfectly on localhost. Then, I deployed the files on Linode server at path /var/www/html/adminapi2

I again checked above both urls. Login Url(default) works fine(http://50.116.5.82/adminapi2/public/) but url with route: showLoginForm gives 404 error(http://50.116.5.82/adminapi2/public/register)

AM I missing anything?


Solution

  • It seem you are running laravel as subdirectory, to make url rewriting works, you should change public/.htacces file from:

    ...
    
    RewriteRule ^ index.php [L]
    
    ...
    

    to

    ...
    
    RewriteRule ^ adminapi2/public/index.php [L]
    
    ...
    

    Your RewriteRule should configured as subdirectory.

    Hope it helps