问题
I have IIS web server, and I am using the IP address and :80 port to serve the website.
I have two applications. One of them should be served on '/' route, and another one should be accessible on '/admin' route.
I tried multiple advices about "how to serve two websites on one IP and Port", but they do not help me. I also created virtual directory with static files, but still cannot access the second app on '/admin' route
Can you please give me recommendations what do I need to add to "web.config" to make it work. I want the "app1" be on home route, that it, '/', and "app2" be on the "/admin" route, so
111.111.11.11/ - this is "app1"
111.111.11.11/about - this is still "app1"
111.111.11.11/admin - and when the use goes to admin, this is "app2"
回答1:
First, create child application or virtual directory under the mail application. give full access control isur and iis_iusrs.
Convert all absolute links to relative ones. Base tag works only for relative URLs. The bare minimum plain HTML example.
<img src="/assets/logo.svg"/> to <img src="./assets/logo.svg"/>
Add in your index.html. This tag should be placed in the ... before any other element that uses URLs. The best place to put it right above the ... in the index.html
<head>
...
<base href="%PUBLIC_URL%/">
<title>React App</title>
</head>
<body>
...
</body>
Regards, Jalpa
来源:https://stackoverflow.com/questions/56007384/how-to-serve-two-folders-react-build-files-on-one-website-on-iis