Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to deploy angular5 application to sub directory

My angular application is hosted in server in which the application url is http://xyz.domain.in (Example Url). Now I created sub directory inside it to host another application. But when i try to access the path like http://xyz.domain.in/subfolder , getting this in console.

Error: Cannot match any routes. URL Segment: 'subfolder'

Base href of the application in subfolder is

<base href="./subfolder">

How to accomplish this?

like image 848
Manush Avatar asked Jun 22 '18 10:06

Manush


2 Answers

You have to specify the path of your subfolder when launching a build :

ng build --base-href=/subfolder/
like image 87
Artory Avatar answered Oct 29 '22 11:10

Artory


do not need to mention the subfolder name, if you are depolying at subfoler you need to mention only href="./"

like image 34
harish kushwaha Avatar answered Oct 29 '22 11:10

harish kushwaha