clzola clzola - 2 months ago 16
PHP Question

Laravel 5.1 routing not working, only '/'

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:

enter image description here

If I use
php artisan serve
and use
http://localhost:8000/about
everything works fine... What is the problem and how to solve it?

Answer

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>
Comments