So I've just upgraded to Laravel 4, and I'm setting things up on a new server. The default /
route works fine, but every other route returns a 404 error. When trying index.php/route
, I get the requested data, so that means that .htaccess isn't working.
所以我刚刚升级到Laravel 4,我正在新服务器上进行设置。默认/路由工作正常,但每个其他路由返回404错误。在尝试index.php / route时,我得到了请求的数据,这意味着.htaccess无效。
Yes, AllowOverride is set to ALL
.
Yes, I enabled the mod_rewrite module
.
是的,AllowOverride设置为ALL。是的,我启用了mod_rewrite模块。
I have tried the following 3 .htaccess combinations:
我尝试了以下3 .htaccess组合:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
and:
和:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
and:
和:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ http://%{HTTP_HOST}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
And, after a server restart, and so on, none of them are working, and I'm still returning a 404 error.
并且,在服务器重新启动之后,等等,它们都没有工作,我仍然返回404错误。
Note: I am using several domains with the same laravel install, so my public folders are public/site1
, public/site2
, public/site3
. However, I am routing the public paths to these folders, so I'm not sure that would be the problem.
注意:我使用的是几个具有相同laravel安装的域,因此我的公用文件夹是public / site1,public / site2,public / site3。但是,我将公共路径路由到这些文件夹,所以我不确定这是不是问题。
Any thoughts?
有什么想法吗?
1 个解决方案
#1
21
I forgot to edit the vhosts in httpd.conf. Derp, derp. Added:
我忘了在httpd.conf中编辑vhost。 Derp,derp。添加:
<Directory "/var/www/public/site1">
AllowOverride All
</Directory>
to each of the site's vhost files, and it worked beautifully. Derp derp.
到每个站点的vhost文件,它工作得很漂亮。 Derp derp。
#1
21
I forgot to edit the vhosts in httpd.conf. Derp, derp. Added:
我忘了在httpd.conf中编辑vhost。 Derp,derp。添加:
<Directory "/var/www/public/site1">
AllowOverride All
</Directory>
to each of the site's vhost files, and it worked beautifully. Derp derp.
到每个站点的vhost文件,它工作得很漂亮。 Derp derp。