I have created a new laravel project in /var/www/polyforms.me
and created virtual host file polyforms.conf
:
<VirtualHost *:80>
ServerName polyforms.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/polyforms.me/public
ErrorLog ${APACHE_LOG_DIR}/polyforms.me-error.log
CustomLog ${APACHE_LOG_DIR}/polyforms.me-access.log combined
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
When I go to polyforms.dev
it opens home page as it should, but when I go to let's say polyforms.dev/about
it shows me this:
If I use php artisan serve
and use http://localhost:8000/about
everything works fine... What is the problem and how to solve it?
I guess .htaccess is ignored. http://httpd.apache.org/docs/2.2/en/mod/core.html#allowoverride
<VirtualHost *:80>
ServerName polyforms.dev
ServerAdmin webmaster@localhost
DocumentRoot /var/www/polyforms.me/public
<Directory "/var/www/polyforms.me/public">
AllowOverride all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/polyforms.me-error.log
CustomLog ${APACHE_LOG_DIR}/polyforms.me-access.log combined
</VirtualHost>
Do you have a .htaccess file in the web root that points everything to index.php? If not, that's the problem (see the Laravel docs on what to add where). If so, Apache may be configured to deny .htaccess overrides. In that case you'll need to add a segment in your VirtualHost configuration allowing those. See the Apache documentation for more information. It also may be the case that mod_rewrite is not enabled. If using Ubuntu, Debian or other Debian-based OS is used a sudo a2enmod rewrite
followed by sudo service apache2 reload
will suffice.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With