@Injectable()
export class AppHttpInterceptor implements HttpInterceptor {
constructor() {}
intercept(
req: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
this.loadingService.show();
return next.handle(req).pipe(
tap(evt => {
if (evt instanceof HttpResponse) {
if(evt != null) {
// here we are hide the loader flag
this.loadingService.hide();
}
}
}),
catchError((err: any) => {
if(err instanceof HttpErrorResponse) {
try {
// if we are getting the erorr we also have to hide the loader
this.loadingService.hide();
} catch(e) {
console.log(e)
}
//log error
}
}));
}
}
/
www\
\animals
.htacess
.htacess
文件夹中的第一个.htacess
:
www
对于每个项目(例如RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !^.*on [OR]
RewriteCond %{HTTP_HOST} ^test\.com$
RewriteRule ^(.*)$ https://www.test.com/$1 [R,L]
),我必须有相同的animals
:
.htaccess
是否有可能将所有规则仅放在RewriteEngine On
RewriteBase /animals/
RewriteCond %{ENV:HTTPS} !^.*on
RewriteRule ^(.*)$ https://www.test.com/animals/$1 [R,L]
文件夹的 main .htacess
中?