-1

I am fairly new to development and am working on an Angular project Which I have inherited from someone else.

I am currently trying to set up a development server and so, I copied all the build files generated using the ng build --prod (Angular command) from the production server and imported them to the development server.

After some apache configuration and making some changes to my hosts file, I tried entering the page i.e. pages.100pins.com which went well and everything seems to work. home page

But when i tried to change the url to pages.100pins.com/client/lrr/login, The requested URL /client/lrr/login was not found on this server.couldn't find

But the same url works fine when routed to the production server . picture of that

I feel that I am missing some critical element here but couldn't find any solution for this.

I need some help.

yash
  • 1
  • 1

1 Answers1

0

You have to configure Apache properly to allow deep linking in an angular application. You could create a .htaccess file and put it into angular's public directory (where the index.html lies)

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

RewriteRule ^(.*) /index.html [NC,L]
</IfModule>

Also refer to: https://angular.io/guide/deployment

CarlitosJan
  • 183
  • 8
  • I added this and the application no longer says that The requested URL /client/lrr/login was not found on this server but is getting redirected to the the pages.100pins.com and is showing a blank page – yash Aug 09 '22 at 15:08
  • Maybe you have changed some other configuration for apache and your hosts file. I don't know then why it is not working. I have deployed many angular applications and if you have the apache server with default config, it always worked fine. May be check your hosts file configuration. I dont think it is necessary to configure that – CarlitosJan Aug 09 '22 at 16:02