【问题标题】:about httpd.conf关于 httpd.conf
【发布时间】:2011-02-06 17:27:04
【问题描述】:

我开始学习 symfony for php 框架,但我遇到了 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 问题?

谢谢!!!

【问题讨论】:

  • 如果您尝试设置基于名称的虚拟主机,那么我认为您需要阅读文档。如果你不是,那么你需要解释你想要做什么。
  • 我尝试将来自localhost/symfonytest 的所有请求“重定向”到 localhost/symfonytest/web/index.php (同时对用户隐藏 conf/)

标签: php apache symfony1 httpd.conf


【解决方案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>

这应该可以按您的预期工作。

【讨论】:

    猜你喜欢
    • 2012-08-25
    • 2018-11-20
    • 2019-12-10
    • 1970-01-01
    • 2016-04-09
    • 2019-03-06
    • 2014-03-19
    • 2011-07-04
    • 2012-12-13
    相关资源
    最近更新 更多