-
-
Save mustafamagdy/6ae945c3a0f3296ba5ae568f13954f9d to your computer and use it in GitHub Desktop.
IIS Config to React Router App
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <system.webServer> | |
| <rewrite> | |
| <rules> | |
| <rule name="React Routes" stopProcessing="true"> | |
| <match url=".*" /> | |
| <conditions logicalGrouping="MatchAll"> | |
| <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | |
| <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> | |
| <add input="{REQUEST_URI}" pattern="^/(api)" negate="true" /> | |
| </conditions> | |
| <action type="Rewrite" url="/" /> | |
| </rule> | |
| </rules> | |
| </rewrite> | |
| </system.webServer> | |
| OR | |
| <system.webServer> | |
| <rewrite> | |
| <rules> | |
| <rule name="Rewrite Text Requests" stopProcessing="true"> | |
| <match url=".*" /> | |
| <conditions> | |
| <add input="{HTTP_METHOD}" pattern="^GET$" /> | |
| <add input="{HTTP_ACCEPT}" pattern="^text/html" /> | |
| <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> | |
| </conditions> | |
| <action type="Rewrite" url="/index.html" /> | |
| </rule> | |
| </rules> | |
| </rewrite> | |
| </system.webServer> | |
| OR | |
| <?xml version="1.0" encoding="utf-8"?> | |
| <configuration> | |
| <system.webServer> | |
| <rewrite> | |
| <rules> | |
| <rule name="DynamicContent"> | |
| <conditions> | |
| <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="True"/> | |
| </conditions> | |
| <action type="Rewrite" url="index.html"/> | |
| </rule> | |
| </rules> | |
| </rewrite> | |
| </system.webServer> | |
| </configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment