我正在尝试在子文件夹中嵌套两个React应用程序,并使用.htaccess重定向。
我无权访问根文件夹上的.htaccess
这是我的目录结构-
html/ ├─ react-app-1/ │ ├─ react-app-2/ │ │ ├─ index.html │ │ ├─ .htaccess │ ├─ .htaccess │ ├─ index.html ├─ other_subfolders_with_websites/...
react-app-1
with Router与react文档中的.htaccess
配合得很好
Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [QSA,L]
但是,每当我转到www.example.com/react-app-1/react-app-2
时,我都希望react-app-2
提供它的index.html,但URL被转发到react-app-1
的路由器。
我测试了很多RewriteRules和RedirectMatch,但其他规则都会崩溃react-app-1
。
请为.htaccess
建议RewriteRules以实现此目的。
非常感谢。
使用RewriteCommand、RewireRule和RedirectMatch尝试了多个.htaccess规则,但其他规则都崩溃react-app-1
。