You have to point to the public folder and here is an example of .htaccess https://laravel.com/docs/7.x/installation#pretty-urls
Jun 7, 2020
13
Level 1
404 Not Found error on local install
These are the steps and configs I've done so far to get Laravel going on my local openSUSE Linux machine:
- new folder in ~/home/linuxoid/Develop/www/laravel
- :~/Develop/www/laravel>composer create-project --prefer-dist laravel/laravel blog
- :~/Develop/www/laravel/blog>php artisan serve
- checked in Firefox: localhost:8000 - see the Laravel default page - all is OK
- added the following to /etc/apache2/httpd.conf:
<Directory "/home/linuxoid/Develop/www">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
- added new file local.conf in /etc/apache2/vhosts.d with:
<VirtualHost *:80>
ServerAdmin localhost
DocumentRoot /srv/www/htdocs/
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
ServerAdmin linuxoid
DocumentRoot /home/linuxoid/Develop/www/
ServerName linuxoid.dev
ServerAlias linuxoid
<Directory /home/linuxoid/Develop/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
RewriteEngine On
Require all granted
</Directory>
</VirtualHost>
- added this in /etc/hosts:
127.0.0.1 linuxoid.dev linuxoid
- restarted the server
- added an .htaccess to ~/Develop/www/laravel/blog with:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /laravel/blog
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/ [L]
</IfModule>
... and the problem is when I go to http://linuxoid/laravel/blog I get a 404 | Not Found error! If I go directly to the public folder, I get the Laravel default page.
How can I set up the local virtual host to get to the Laravel's public folder where http://linuxoid/laravel/blog should be the site's base url? What am I missing or doing wrong?
Thank you.
Please or to participate in this conversation.