.htaccess with Enabled mod_rewrite setting for deploy ng2 app on apache2
- Installed dependencies using npm install.
- Used ng build --prod command and it created a dist directory.
- Move dist/* to public dir
- Enabled mod_rewrite, restarted apache and added this .htaccess in my dist directory.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
- Set/Check
<base href="/demo/dist/">
Base Path