3

This has been asked multiple times, but still i don't seem to figure out whats the problem in my angular app.

My routing works fine, until I refresh the page and it gives me "page not found". Popular solution is that I add a .htaccess file to the root of my app, but it's still not working. I've even tried differrent .htaccess scripts.

speyburn
  • 63
  • 1
  • 5

1 Answers1

10

Try this .htaccess:

Options +FollowSymLinks

<ifModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !index
    RewriteRule (.*) index.html [L]
</ifModule>
jesal
  • 7,852
  • 6
  • 50
  • 56
  • 2
    Did you test your answer ? I got this : "The requested URL /index.html/ was not found on this server." – Romain Oct 17 '14 at 14:52
  • @RomainFournereau That snippet is from one of my AngularJS projects. So yes, it works for me although YMMV depending on your environment/configuration. – jesal Jan 07 '15 at 21:18