XAMPP - 重写规则不起作用

XAMPP - Rewrite Rule doesn't work

我正在使用 XAMPP (Windows 7),在 httpd.conf 我有:

htdocs 目录中,我有一个名为 shop 的子目录,这是我的网站。在 shop 中,我还有一个名为 shirts 的子目录,其中包含文件:

要打开它,您只需输入以下内容 url:http://localhost/shop/shirts/shirts.php

但是,当我打开 http://localhost/shop/shirts/ - 浏览器显示目录列表时,我希望它打开 shirts.php。

因此,在 /shirts 目录中,我创建了以下 .htaccess 文件:

RewriteEngine On
RewriteRule ^shirts/$ /shop/shirts/shirts.php

但是没有用。你知道我做错了什么吗,为什么这不起作用?

提前致谢!

尝试将此 DirectoryIndex index.php shirts.php 写入您的 .htaccess 文件