【问题标题】:XAMPP: Alias issue - Error 404XAMPP:别名问题 - 错误 404
【发布时间】:2011-10-20 10:03:01
【问题描述】:

我试图给它起别名: /htdocs/test/index.php

在我的 xampp/apache/conf/extra/httpd-xampp.conf 中,我有以下条目:

<IfModule alias_module>
<IfModule mime_module>
    Alias /test/ "D:/Installation/xampp/htdocs/test"
    <Directory "D:/Installation/xampp/test">
           <IfModule php5_module>
            <Files "index.php">
                php_admin_flag safe_mode off
            </Files>
        </IfModule>
        Order allow,deny
        Allow from all
    </Directory>
</IfModule>
</IfModule>

当我转到http://localhost/test/ 时,我会看到显示的目录列表。当我输入这个 URL - http://localhost/test/ 时,我想要打开这个文件 - /test/index.php。

当我尝试直接访问此 URL“localhost/test/index.php”时,我收到“找不到错误 404 对象”消息。

我做错了什么?

【问题讨论】:

    标签: apache xampp alias httpd.conf


    【解决方案1】:

    使用以下内容查找 httpd-xampp.conf 文件的部分:

    #
    # DirectoryIndex: sets the file that Apache will serve if a directory
    # is requested.
    #
    <IfModule dir_module>
        DirectoryIndex index.html index.htm
    </IfModule>
    

    将“index.php”添加到 DirectoryIndex 行。

    【讨论】:

    • 您上面提到的代码已经包含在httpd.conf文件中。我也尝试在 httpd-xampp.conf 中包含该代码,但没有任何效果。还有什么可以推荐的吗?
    猜你喜欢
    • 2012-07-20
    • 2015-04-06
    • 2018-02-17
    • 1970-01-01
    • 2016-12-14
    • 2018-06-27
    • 2015-10-17
    • 2011-02-26
    • 1970-01-01
    相关资源
    最近更新 更多