【发布时间】:2021-04-09 13:17:18
【问题描述】:
我在同一个子域中有两个反应应用程序 - 在不同的目录中。
- app.domain.com
- app.domain.com/login
为了让反应路由器工作,我有现有的 .htaccess 规则将所有流量重定向到应用程序 (index.html)
RewriteEngine On
#Redirect to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
#Not sure what this does
RewriteCond %{QUERY_STRING} ^open&guid=
RewriteRule ^ ? [R=301,L,NE]
#Not sure what this does
RewriteRule ^index\.html$ - [L]
#Redirect all to index.html
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
我想允许在 /login 目录中加载 react 应用 并且将所有 /login/* 请求重定向到 /login/index.html。
如何使用.htaccess 应用这些规则?
亲切的问候 /K
【问题讨论】:
标签: reactjs .htaccess mod-rewrite url-rewriting friendly-url