-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeb.config
More file actions
41 lines (36 loc) · 1.86 KB
/
Web.config
File metadata and controls
41 lines (36 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.6.1" />
<httpRuntime targetFramework="4.6.1" />
</system.web>
<!-- The following solves the AngularJS 404 problem on an SPA when a page is refreshed -->
<!-- As we know, clicking on links on a page is captured by Angular's routing system, and the proper page is rendered. -->
<!-- However, if a user refreshes the page, or enters a url in the address bar, or even loads a bookmark from the main toolbar, -->
<!-- these are outside the scope of the routing system and are directed to the server. If routing has not been set up on the server, -->
<!-- then we get a 404 error stating that the resource cannot be found. To deal with this, the following code configures the server to -->
<!-- to redirect to the main page 'index.html', this allows the Angular routing system to take over and render the proper page. -->
<system.webServer>
<rewrite>
<!--This directive was not converted because it is not supported by IIS: RewriteBase /.-->
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^index\.html" ignoreCase="false" />
<action type="None" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="." ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>