我正试图在家里的本地服务器上设置laravel,我似乎无法
得到控制器路线,例如:
得到控制器路线,例如:
Route::controller('home','home');
这段代码可以在我工作的服务器上运行,我已经阅读了一些关于这个的论坛
声称问题的问题是因为apache2未配置为查看
.htaccess文件.
我已经搞砸了一段时间,但我似乎仍无法得到任何工作.
我进入/ etc / apache2 / sites-available并创建了我自己的配置文件,名为site1
看起来像这样:
<VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/laravel/ <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/laravel/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log # Possible values include: debug,info,notice,warn,error,crit,# alert,emerg. LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined Alias /doc/ "/usr/share/doc/" <Directory "/usr/share/doc/"> Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 </Directory>
然后我运行了a2dissite默认&& a2ensite site1和/etc/init.d/apache2 restart
但什么都没发生.
感谢您的帮助,如果我需要澄清任何内容,请告诉我.
解决方法
结果问题是mod_rewrite.c没有启用,所以我运行a2enmod重写,一切都开始工作了.我注意到了 laravel中的.htaccess文件依赖于它.傻我.谢谢你们 救命.