-2

I've an angular project and i published my website in domain https://rataport.com.

In this domain when I clicked on products and key up crrl+F5 404 page show (https://rataport.com/products/category/7441). enter image description here

What could be the reason?

georgeawg
  • 48,608
  • 13
  • 72
  • 95
Mojtaba Nava
  • 858
  • 7
  • 17

1 Answers1

1

Angular doesn't have physical pages representing those routes but updating the history and the URL using Javascript.

You can start browsing from the root (/) and make your way to those pages but since there aren't any files or redirections set up on your web server, Angular cannot catch requests coming directly to the said URL.

If you're using Apache Server, you can use following htaccess configuration to direct requests to angular index.html file.

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
  RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d

  RewriteRule ^.*$ - [NC,L]
  RewriteRule ^(.*) index.html [NC,L]
</IfModule>
CodingSomething
  • 449
  • 3
  • 10