I am trying to figure out how to get a 404 document status error for a page not found in my AngularJS application in order to maintain good SEO. I would like to do something similar to how the Red Bull Sound Select website does it, but I'm not sure how they do it?
Example 404 URL
https://www.redbullsoundselect.com/no-page-here 
As you can see in the above example, the URL changes to / 404, and you get 404 document status status for the source path in the URL ie no-page-here
In my AngularJS application, I only have:
.otherwise({ class: 'page-not-found', title: '404 Page Not Found', description: '404 Page Not Found', templateUrl: '/app/static/404.html', controller: 'mainController as mainCtrl' });
I could use something like:
otherwise({ redirectTo: '/404' });
This is similar to what the redbull site has, but it still does not give 404 document status errors. (also changing the URL to 404 rather than saving the original URL, which is not very convenient for SEO, but at least the bad URL will not be indexed by Google.)
I thought I could try to make an existing http request in Angular to get 404 xhr status, but I don't think that would be enough.
I read a few answers that suggested using prerender.io, but this is what you have to pay for, which seems a bit simple to get the 404 pages the right job.
Perhaps there is something we can do in our .htaccess to handle 404 pages in different ways? We are currently rewriting the rules so that any requested resource that does not exist will use /index.html. Perhaps we can make an exception because of how 404 pages are processed in Apache.
UPDATE
I found on redbullsoundselect.com that they use the following in their app.js
$stateProvider.state("404", { url: "/404", templateUrl: "/views/site/404.html", controller: "NotFoundController" });
Although, I still do not understand how this logic works. I looked in the NotFoundController , but little is going on in it.
Could this be with them using ui.router instead of ngRoute like me?
Second update
This is my .htaccess setting:
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 does not exist, use index.html RewriteRule ^ / index.html