将所有对别名的调用重定向到相同别名的子文件夹中的一个页面


Redirect all calls to alias to one page in sub folder on same alias

我在wamp服务器上创建htaccess文件时遇到问题
我希望所有对localhost服务器上别名(虚拟文件夹)的调用重定向到同一别名上的公用文件夹。例如,我想

http://localhost/test/***/ or http://localhost/test/***/***/***/

重定向到

http://localhost/test/public/indes.php?a=******.

我发现了很多例子,但没有一个工作不正常,我收到了一个错误"页面重定向不正确"或"500内部服务器错误"。

这是我的htaccess示例文件:

RewriteEngine on
RewriteBase /test
RewriteRule ^(.*)$ http://localhost/test/public/index.php [R=301,L]

有人能告诉我哪里错了吗
提前感谢您的回复。

我会尝试一下:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /test/public/index.php