Elastic Beanstalk: remove hashbang urls from SPA

I have an AngularJS app hosted using Elastic Beanstalk and I’d like to remove the hashbangs (#!) from urls, but am having trouble using config files to make the necessary modifications to the Apache server.

I have enabled html5mode in my angular app and I currently have the following config file in my .ebextensions directory

    mode: "000644"
    owner: root
    group: root
    content: |
        RewriteEngine On  
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]  
        RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d  
        RewriteRule ^ - [L]

        RewriteRule ^ /index.html  

Everything works fine without the hashbangs until I reload the page and I get a 404 indicating that the rewrite rules aren’t working.

If possible, I’d like to avoid any solutions that involve ssh, copying, and modifying one of the default configs as this will likely make maintenance a nightmare if AWS changes any defaults down the road

Source: AngularJS