Laravel项目没有向我展示index.php

时间:2016-02-10 10:58:56

标签: .htaccess laravel-5 wamp vhosts

我使用Win10和WAMP服务器。 我安装了wamp并创建了我的虚拟主机

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "c:/wamp/www/project/public"
    ServerName project
    <Directory  "c:/wamp/www/project/public">
        Options Indexes FollowSymLinks
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

然后我使用Composer + git获取项目(laravel),但是当我尝试访问我的项目时,它会向我显示文件夹Inside public而不是index.php

这是我的.htaccess

<IfModule mod_rewrite.cs>
    <IfModule mod_negotiation.c>
        Option -MultiViews
    </IfModule>

      RewriteEngine On


      # Redirect Trailing Slashes If Not A folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]

</IfModule>

1 个答案:

答案 0 :(得分:0)

如果它没有执行PHP,请检查您的WAMP安装。另外,检查php-mcrypt扩展是否已安装并处于活动状态。在虚拟主机中,我使用以下配置:

<VirtualHost *:80>
ServerName homestead.app
DocumentRoot "c:/wamp/www/project/public"
<Directory  "c:/wamp/www/project/public">
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
</Directory>
</VirtualHost>

其中homestead.app是您的名字并将其添加到主机文件