我知道这是个很老的问题,但是当我试图找到正确的解决方案时,我没有运气。我已经尝试了每一个可能的配置,但仍然没有运气。我正在使用laravel进行PHP项目。当在htdocs中将laravel.labs设置为vhost时,我完全没有问题。但是,当我将它移动到分隔的文件夹(即C:\vhost)中时,我得到了这个403错误。vhost文件夹的用途是保存多个vhost。以下是我的配置:
系统: windows 7 64位XAMPP v1.7.7 Apache/2.2.21 PHP: 5.3.8
httpd.conf :
# Virtual hosts
Include "conf/extra/httpd-vhosts.conf"httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
  DocumentRoot C:/xampp/htdocs
  ServerName localhost
</VirtualHost>
<VirtualHost *:80>
  DocumentRoot c:/vhosts/laravel_labs/public
  ServerName laravel.labs
</VirtualHost>c:\windows\system32\driver\etc\host
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
127.0.0.1                   laravel.labsC:\vhosts\laravel_labs\public)内部的.htaccess
<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>
    RewriteEngine On
    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]
    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>有人能帮我找到我错过的东西吗?伙计们有什么建议吗?谢谢
发布于 2014-01-24 12:17:55
最后,我找到了这个问题的答案。我必须在httpd.conf中添加一些行
就像这样:
Alias /laravel_labs/public "C:/vhosts/laravel_labs/public/"
<Directory "C:/vhosts/laravel_labs/public/">
    AllowOverride All
    Order Allow,deny
    Allow from all
</Directory>请参阅这里的详细说明:http://www.youtube.com/watch?v=Z250saioXIs
发布于 2014-01-24 00:57:40
每次添加新的别名或DocumentRoot时,都需要一个类似于默认DocumentRoot的部分。取决于您的发行版,这要么是类似于
Order deny,allow 或
require all grantedhttps://stackoverflow.com/questions/21316361
复制相似问题