【发布时间】:2015-11-10 00:02:47
【问题描述】:
我正在使用 Laravel 5.1 和一个使用 Apache 的 PuPHPet VM(所以不是 Homestead)。
我的公共目录中有默认的 .htaccess;
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
我已经进入了apache2.conf;
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all granted
</FilesMatch>
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
我已经重启了apache2;
sudo service apache2 restart
但我仍然找不到;
http://192.168.56.131/auth/register
但没有;
http://192.168.56.131/public/auth/register
所以我不确定现在该尝试什么。它的一部分必须工作,因为不再需要index.php
* 更新 *
这是有效的;
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [QSA,L]
但事实并非如此;
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
它只是不喜欢整个“公共”的东西。
这是我的 apache2.conf 文件的更新部分;
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
真令人沮丧!我不明白我在这里缺少什么。
【问题讨论】:
标签: php apache .htaccess laravel-5