1

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?

2
  • 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-styles Commented 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] Commented Nov 15, 2017 at 14:42

2 Answers 2

1

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> 
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you very much! Installing and enabling mod_rewrite fixed the problem! :)
@PierreDuc, can you help here stackoverflow.com/q/47315228/2761641
0

Uncomment this line at "/etc/apache2/httpd.conf"

#LoadModule rewrite_module libexec/apache2/mod_rewrite.so

To

LoadModule rewrite_module libexec/apache2/mod_rewrite.so

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.