[READ-ONLY] Mirror of https://github.com/thoda-dev/angular-cli-redirect-script. server config scripts for IIS and Apache for angular cli to make url to work directly in browser
0

Configure Feed

Select the types of activity you want to include in your feed.

base version

Thomas (Mar 12, 2019, 4:07 PM +0100) ba74b064 d31400d9

+55 -2
+31 -2
README.md
··· 1 - # angular-cli-redirect-script 2 - server config for angular url to work directly in browser 1 + # Angular-cli-redirect-script 2 + 3 + Server configuration file to add to your project for URL rewrite to work fine in production 4 + 5 + # How to use 6 + 7 + - copy the file depending on your platform to the source root directory of your project (`<project_patch>/src/`) 8 + * `.htaccess` for apache 9 + * `web.config` for IIS 10 + - open the file `angular.json` or `angular-cli.json` depending on the angular version (should be at the root of your project) 11 + - add the script to the build assets like the favicon `favicon.ico` or the `assets` directory 12 + 13 + For apache : 14 + 15 + ```json 16 + "assets": [ 17 + "src/favicon.ico", 18 + "src/assets", 19 + "src/.htaccess" 20 + ] 21 + ``` 22 + 23 + For IIS : 24 + 25 + ```json 26 + "assets": [ 27 + "src/favicon.ico", 28 + "src/assets", 29 + "src/web.config" 30 + ] 31 + ```
+7
apache/.htaccess
··· 1 + RewriteEngine On 2 + # If an existing asset or directory is requested go to it as it is 3 + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] 4 + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d 5 + RewriteRule ^ - [L] 6 + # If the requested resource doesn't exist, use index.html 7 + RewriteRule ^ /index.html
+17
iis/web.config
··· 1 + <?xml version="1.0" encoding="utf-8"?> 2 + <configuration> 3 + <system.webServer> 4 + <rewrite> 5 + <rules> 6 + <rule name="Angular Routes" stopProcessing="true"> 7 + <match url=".*" /> 8 + <conditions logicalGrouping="MatchAll"> 9 + <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> 10 + <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> 11 + </conditions> 12 + <action type="Rewrite" url="./index.html" /> 13 + </rule> 14 + </rules> 15 + </rewrite> 16 + </system.webServer> 17 + </configuration>