0

我开始为 php 框架学习 symfony,但我遇到了 httpd.conf 配置的问题。

首先,我在我的 Windows c:\xampplite\ 上安装了 xampplite

然后我创建了一个 symfony 项目(如入门指南中所述)c:\xampplite\htdocs\symfonytest\

当我尝试访问http://localhost/symfonytest/web/时一切正常 (所有图标和文本都显示得很好)

现在我必须配置 httpd.conf 并输入如下内容:

<VirtualHost 127.0.0.1/symfonytest>
DocumentRoot "c:\xampplite\htdocs\symfonytest\web"
DirectoryIndex index.php
<Directory "c:\xampplite\htdocs\symfonytest\web">
AllowOverride All
Allow from All
</Directory>
    Alias /sf c:\xampplite\htdocs\symfonytest\web\sf
    <Directory "c:\xampplite\htdocs\symfonytest\web\sf">
    AllowOverride All
    Allow from All
</Directory>

但它根本没有效果......当我输入http://127.0.0.1/symfonytest/它仍然显示我的 c:\xampplite\htdocs\symfonytest\ 的目录列表

如何解决这个 httpd.conf 问题?

谢谢 !!!

4

1 回答 1

1

您不能使用 VirtualHost 来做到这一点。相反,使用别名:

Alias /symphonytest/ "c:\xampplite\htdocs\symfonytest\web"

<Directory "c:\xampplite\htdocs\symfonytest\web">
AllowOverride All
Allow from All
</Directory>
Alias /sf/ c:\xampplite\htdocs\symfonytest\web\sf
<Directory "c:\xampplite\htdocs\symfonytest\web\sf">
AllowOverride All
Allow from All
</Directory>

这应该像您期望的那样工作。

于 2010-04-11T22:11:35.640 回答