我使用Laravel 5.1与PuPHPet VM使用Apache(所以不是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
但是我仍然得到一个not found on;
http://192.168.56.131/auth/register http://192.168.56.131/public/auth/register所以我不知道现在该怎么做。它的一部分必须工作,因为不再需要index.php
* UPDATE *
正在工作;
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>
那么令人沮丧!我不明白这里缺少了什么
你的Apache配置应该放在vhost配置文件中,而不是htaccess。
PuPHPet使用php-fpm, mod_php支持在几个月前被取消。
Try
RewriteEngine On
RewriteRule ^(.*)$ /public/$1 [L]