问题描述
我在/var/www/polyforms.me
中创建了一个新的laravel项目,并创建了虚拟主机文件polyforms.conf
:
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
当我进入polyforms.dev
时,它会按原样打开主页,但是当我进入polyforms.dev/about
时,它会向我显示此内容:
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:
如果我使用php artisan serve
并使用http://localhost:8000/about
,一切都很好...问题是什么以及如何解决?
If I use php artisan serve
and use http://localhost:8000/about
everything works fine... What is the problem and how to solve it?
推荐答案
我猜.htaccess被忽略了. http://httpd.apache.org/docs/2.2/en /mod/core.html#allowoverride
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>
这篇关于Laravel 5.1路由除了'/'以外不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!