Angular 4 Deployment

Use any of the commands:

  1. ng build
  2. ng build –prod
  3. ng build –prod –base-href /directory-name/sub-directory-name/

Create testing branch on github

  1. add normal git repository
  2. git branch gh-pages
  3. git push -u origin gh-pages

To push on the git repository

  1. git init
  2. git add origin
  3. git add .
  4. git commit -m “Initial Commit”
  5. git push -u origin master
  6. ng build –prod –base-href
  7. ngh

ng build –prod –base-href



.htaccess for production site

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]


Leave a Reply

Your email address will not be published. Required fields are marked *