edkeveked
edkeveked

Reputation: 18381

angular deployment on the apache server

I followed the steps outlined here. I copied and paste the code below in .htaccess file. The .htaccess file is in the same repository that contains my dist folder that I am going to deploy on apache.

RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]

# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html

When I access localhost/dist everything goes fine, since it will use my index.html file and it will automatically redirect to localhost/dist/login. Now if I request directly localhost/dist/login, apache complains and displays The requested URL /dist/login was not found on this server. It seems for me that apache does not picked up my .htaccess settings. Is there something I am doing wrong?

Upvotes: 1

Views: 443

Answers (1)

edkeveked
edkeveked

Reputation: 18381

Finally I found a way to solve my problem. Maybe this could help some. I enabled the rewrite mode of Apache and instead of

RewriteRule ^ /index.html,

I wrote

RewriteRule ^ /dist/index.html

and this solved my problem.

Upvotes: 1

Related Questions