4

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?

clzola
  • 1,925
  • 3
  • 30
  • 49

3 Answers3

9

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>
everyman
  • 3,377
  • 1
  • 34
  • 33
5

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.

Plenka
  • 1,099
  • 7
  • 17
0

You have .htaccess file in your public folder. So copy that into cpanel's root .htaccess file.

prashanth-g
  • 1,183
  • 2
  • 13
  • 28