I want to deploy my Angular Application on my Apache Webserver. I already added a .htaccess file to my /var/www/html folder, I tried several base-hrefs. But like many people I have problems with routing. I can only see my Startpage, but when I want to get to a other URL it fails. What else can I try or have I missed something?
- Try to add hashed to your url pattern. It looks like your setup of your server is not correct. angular.io/guide/router#browser-url-stylesJasper Seinhorst– Jasper Seinhorst2017-11-15 08:17:41 +00:00Commented Nov 15, 2017 at 8:17
- @Taha Obed, can we have a chat, I am trying to do same thing, like I want to deploy Angular 4 application on apache server, and I want to know the nitty gritty involved, my gmail is [email protected]Akshay Vijay Jain– Akshay Vijay Jain2017-11-15 14:42:59 +00:00Commented Nov 15, 2017 at 14:42
Add a comment |
2 Answers
You have to enable/install the Apache mod_rewrite module, and then put this in either your .htaccess or your apache configuration for your site:
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.html$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.html [L] </IfModule> 2 Comments
Taha Obed
Thank you very much! Installing and enabling mod_rewrite fixed the problem! :)
Akshay Vijay Jain
@PierreDuc, can you help here stackoverflow.com/q/47315228/2761641