Apache htaccess重定向卡在循环中

Apache htaccess重定向卡在循环中,apache,.htaccess,redirect,http-status-code-301,Apache,.htaccess,Redirect,Http Status Code 301,在我编写的工具中,我只需要“Public”子文件夹中的avible index.php文件,我的根目录结构(我的应用程序)如下 uapi(root) /Application /Config /Public Index.php /Storage .htaccess 我希望除Public之外的所有文件夹都被重定向到/Public/Index.php,它不能基于域,因为这个工具可以下载并安装在用户服务器上 这是.htaccess,但它通常会打开目录,而不

在我编写的工具中,我只需要“Public”子文件夹中的avible index.php文件,我的根目录结构(我的应用程序)如下

uapi(root)
   /Application
   /Config
   /Public
       Index.php
   /Storage
   .htaccess
我希望除Public之外的所有文件夹都被重定向到/Public/Index.php,它不能基于域,因为这个工具可以下载并安装在用户服务器上

这是.htaccess,但它通常会打开目录,而不是重定向

Redirect 301 /Storage/ http://localhost:800/web/uapi/Public/
Redirect 301 /Application/ http://localhost:800/web/uapi/Public/
Redirect 301 /Config/ http://localhost:800/web/uapi/Public/

重定向
指令仅适用于绝对路径名。因此,如果您正在使用它们,.htaccess文件应该位于web服务器的根目录下,并且应该有完整的路径名(
/web/uapi/Storage
)。在我看来,最好使用mod_rewrite实现同样的效果

RewriteEngine On
RewriteRule ^(?:Storage|Application|Config)/$ Public [L]