I have an angular (1.5.9) app hosted on Amazons Elastic Beanstalk.
I want to remove the #
from URLs and have followed this guide and others similar to it.
update of app.js is done:
$locationProvider.html5Mode(true);
update of index.html done:
<head> ... <base href="/"> </head>
update of all references are done:
/#/login -> /login
I have ssh'd to my amazon server and created a .htaccess file there:
[ec2-user@ip-xxx-xx-x-xxx]$ ll -a /var/www/html total 12 drwxr-xr-x 2 root root 4096 22 maj 13.43 . drwxr-xr-x 6 root root 4096 1 maj 23.56 .. -rw-r--r-- 1 root root 339 22 maj 13.43 .htaccess
with the content:
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
I have the index.html and the app.js files under the /src/main/resources/static directory
Accessing www.mypage.com and navigating to www.mypage.com/about works great with NO # in the url, but refreshing the page gives 404.
What am I doing wrong? How is this normally done on Amazon servers?