Contents hide 1) Normal Way To Host Angular 10 Application 2) Hosting Angular In Sub Folder In this tutorial, we will see how can we Build And Host Angular 10 Application. Hosting an angular application can be done with different configs. Normal Way To Host Angular 10 Application After the development, we can create a compiled version of our angular application for a prod version using the Angular CLI command. bash ng build --prod As it will create a compiled version of your application inside the dist folder. and for hosting the application upload all the compiled files to your server root directory i.e. public_html After that, you have to add a .htaccess file into the same root directory .htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(.*) /index.html [NC,L] </IfModule> Hosting Angular In Sub Folder For deploying the angular application into a subfolder of your root hosting folder i.e. public_hmtl Assume if you want to add your angular application into the services folder. example URL: http://example.com/services ng build --prod --base-href=/services/ This will set an app base while the build is performed inside the index.html file, you donβt have to do anything. index.html <base href="/services/"> And for this subfolder, you have to define the subfolder in the htaccess file. .htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(.*) /services/index.html [NC,L] </IfModule> Note: The above method will only work for the apache and nginx server and your angular application doesnβt have SSR universal enabled. Get More tutorials on Angular 10 Share this:TwitterFacebookRedditLinkedInWhatsAppPrintTumblr Related Tags: Angular, Build --prod, Hosting