0

I deployed by "build" on my IIS server using the url re-write but I notice the application is not loading.

My Reactjs Application is wrapped inside express node.

this is the url of the application not loading: http://booleandev.com/expense-tracker

This is the url of the application loading http://booleandev.com:9000

I noticed the reason for the application not loading is because all the links were linking to a broken link - booleandev.com/static/...

how do I solve this issue.

Thank you.

Olu Teax
  • 149
  • 1
  • 5
  • Is your issue solved? If your issue is solved then I request you to mark the helpful suggestion as an answer. This will help other people who face the same issue. If your issue still exists then try to refer the solution given by the community members. If then also you have any further questions then let us know about it. We will try to provide further suggestions to solve the issue. Thanks for your understanding. – Jalpa Panchal Sep 25 '20 at 01:57

1 Answers1

0

try to use the public path :

const publicPath = '/path/to/subfolder/';

export const routeCodes = {
  HOME: publicPath,
  SEARCH: `${ publicPath }search`,
  ABOUT: `${ publicPath }about`,
};

// Then you can use them like this
// <Route exact path={ routeCodes.ABOUT } component={ About } />

and react-router rule:

<rewrite>
  <rules>
    <rule name="Imported Rule 1" stopProcessing="true">
      <match url="^" ignoreCase="false" />
      <conditions logicalGrouping="MatchAny">
        <add input="{DOCUMENT_ROOT}{URL}" matchType="IsFile" ignoreCase="false" />
        <add input="{DOCUMENT_ROOT}{URL}" matchType="IsDirectory" ignoreCase="false" />
      </conditions>
      <action type="None" />
    </rule>
    <!--# Fallback all other routes to index.html-->
    <rule name="Imported Rule 2" stopProcessing="true">
      <match url="^" ignoreCase="false" />
      <action type="Rewrite" url="/path/to/subfolder/index.html" />
    </rule>
  </rules>
</rewrite>

Reference link:

How to bundle a React app to a subdirectory on a server?

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26