Reputation: 20150
I have a Laravel 8 application that is properly running on a server. I have moved it to a different server but I am now getting a 404 Not Found on the new server. I have not changed anything on the new server so I believe it must an issue related to server. I am unable to diagnose the problem on the server. Details are some details about the app on the server:
File Permissions respects the following
chown -R apache.apache /var/www/LARAVEL_APP
chmod -R 755 /var/www/LARAVEL_APP
chmod -R 755 /var/www/LARAVEL_APP/storage
Routes and Cache have been cleared using the following commands:
php artisan route:clear
php artisan cache:clear
php artisan config:clear
php artisan cache:clear
.htaccess file in LARAVEL-APP/public directory:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
Options +FollowSymlinks
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]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
When navigating to the root of the LARAVEL-APP, I can properly see the following screen. The problem occurs when I try to load the index.html
located in LARAVEL-APP/public/index.php/admin/login
Route List
The list is available when doing php artisan route:list | grep admin/login
| | POST | admin/login | generated::LTvCw5lDDMDMdfPT | Brackets\AdminAuth\Http\Controllers\Auth\LoginController@login | web |
| | GET|HEAD | admin/login | brackets/admin-auth::admin/login | Brackets\AdminAuth\Http\Controllers\Auth\LoginController@showLoginForm
404 Screen
Below is the 404 screen I am getting that seems to be from Laravel itself.
Upvotes: 0
Views: 1886
Reputation: 1349
It seems like you have not enabled mod-rewrite
, try this:
sudo a2enmod rewrite
and also make sure you this in your apache conf:
<Directory "/var/www/">
# ...
AllowOverride All
Require all granted
</Directory>
also restart apache after:
sudo service apache2 restart
Upvotes: 1
Reputation: 41
try this code in .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
I hope this work for you.
Upvotes: 1