У меня есть приложение реакции в корневой папке домена, скажем, www.abc.com.У меня также есть еще одно приложение для бэкэнд-администрирования, к которому я хотел бы, чтобы пользователи обращались по адресу www.abc.com/admin.
Прямо сейчас, каждый раз, когда я пытаюсь сделать / admin, основной маршрут React App выбирает / admin и перенаправляет меня на страницу 404 Not Found.Он ловит это:
Есть ли способ, которым я могу структурировать приложения так, чтобы вместо этого он извлекал второе приложение администратора из / admin?
Придется ли мне делать это с помощью файла .htaccess?
Это файл .htaccess корневого приложения (шаблон React):
# Enable rewriting
RewriteEngine On
# If its not HTTPS
RewriteCond %{HTTPS} off
# Comment out the RewriteCond above, and uncomment the RewriteCond below if you're using a load balancer (e.g. CloudFlare) for SSL
# RewriteCond %{HTTP:X-Forwarded-Proto} !https
# Redirect to the same URL with https://, ignoring all further rules if
this one is in effect
RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R,L]
# If we get to here, it means we are on https://
# If the file with the specified name in the browser doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f
# and the directory with the specified name in the browser doesn't exist
RewriteCond %{REQUEST_FILENAME} !-d
# and we are not opening the root already (otherwise we get a redirect loop)
RewriteCond %{REQUEST_FILENAME} !\/$
#REDIRECT FOR ADMIN - JUST A TEST TO SEE IF THIS WORKS
Redirect 301 /admin http://www.google.com
# Rewrite all requests to the root
# RewriteRule ^(.*) /