编程语言
首页 > 编程语言> > php – Laravel 5.1路由不工作,除了’/’

php – Laravel 5.1路由不工作,除了’/’

作者:互联网

我在/var/www/polyforms.me中创建了一个新的laravel项目,并创建了虚拟主机文件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

当我去polyforms.dev它会打开主页,但是当我去说polyforms.dev/about时它会告诉我这个:

enter image description here

如果我使用php artisan服务并使用http:// localhost:8000 /关于一切正常……问题是什么以及如何解决?

解决方法:

我猜.htaccess被忽略了. 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>

标签:php,http-status-code-404,laravel-5-1,laravel-routing
来源: https://codeday.me/bug/20190716/1475931.html