From ab7399c2984b048ef114fa62ce95a44bcda11fe7 Mon Sep 17 00:00:00 2001 From: Lasantha Indrajith Date: Tue, 30 Apr 2019 00:20:02 +0530 Subject: [PATCH 1/2] Fix refreshing page 404 with # --- src/app/app.module.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 34b1b34..07d9017 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,6 +7,8 @@ import { Page2Component } from './page2/page2.component'; import { AppRoutingModule } from './app-routing.module'; import { LandingComponent } from './landing/landing.component'; +import { HashLocationStrategy, LocationStrategy} from '@angular/common' + @NgModule({ declarations: [ AppComponent, @@ -18,7 +20,7 @@ import { LandingComponent } from './landing/landing.component'; BrowserModule, AppRoutingModule ], - providers: [], + providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}], bootstrap: [AppComponent] }) export class AppModule { } From a5eed9c4a406f74f0527f1fd981ef8c161879c26 Mon Sep 17 00:00:00 2001 From: Lasantha Indrajith Date: Tue, 30 Apr 2019 00:25:49 +0530 Subject: [PATCH 2/2] Page reload fix using htaccess more info https://github.com/angular/angular/issues/19009 --- src/apache/.htaccess | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/apache/.htaccess diff --git a/src/apache/.htaccess b/src/apache/.htaccess new file mode 100644 index 0000000..82305f9 --- /dev/null +++ b/src/apache/.htaccess @@ -0,0 +1,12 @@ + + RewriteEngine on + + # Don't rewrite files or directories + RewriteCond %{REQUEST_FILENAME} -f [OR] + RewriteCond %{REQUEST_FILENAME} -d + RewriteRule ^ - [L] + + # Rewrite everything else to index.html + # to allow html5 state links + RewriteRule ^ index.html [L] + \ No newline at end of file