0

我有以下目录结构:

/.htaccess
/index.php
/subfolder1/.htaccess
/subfolder1/index.php
/subfolder2/.htaccess
/subfolder2/index.php

我希望将所有请求重定向到 /index.php。我想通过在 /.htaccess 文件中进行一些更改来实现这一点。

e.g. /abc to be rewritten to /index.php
e.g. /subfolder1/index.php to be rewritten to /index.php

如何使用 webroot/.htaccess 文件执行此操作?

我想这样做是因为,我想在 /index.php 上显示一条消息,如“网站停机维护”消息。我想为网站上的所有子文件夹执行此操作。

4

1 回答 1

1

如果存在子文件夹,则根目录下的 .htaccess 将无效。我的意思是,它会找到那个文件夹并且不重写。

或许你可以在这个问题中找到答案: 类似问题

于 2013-03-11T12:42:38.117 回答