Question: I'm having an issue using angular html5 mode for routing with a spring boot backend. The application works fine when I use ui router's $state.go() to navigate to different url's, but when I attempt to enter a different state's url and go directly to it, it fails to load properly. 

We used a solution similar to what is detailed here (<https://spring.io/guides/tutorials/spring-security-and-angular-js/>), essentially using a spring controller to forward certain pages to the base url, "/". The difference with ours is that we use a base url, 'step', to put before every page but the home page. When we do navigate directly to a different page in our site, however, every resource that is loaded is turned into our index.html file (js, css, etc.). When we look at the network requests, it's appended the 'step' url in front of every request for some reason (so instead of css/style.css, it would be step/css/style.css).

Here's an example of our spring controller:

```
@Controller
public class ViewController {
    @RequestMapping(value="/step/**")
    public String forward() {
        return "forward:/";
    }
}

```

Any help would be appreciated, but keep in mind we have looked into various solutions already such as the link mentioned and several others which have similar solutions.

Answer: 
In combination with thread and [this source](https://jhipster.github.io/tips/010_tip_configuring_html_5_mode.html) we finally got it working. In our case there aren't any subpages. Maybe it helps someone:

```
@RequestMapping(value = "/**/{id:[^\\.]*}")
public String html5Forwarding() {
    return "forward:/index.html";
}

```

The `/**/` in the beginning helps to map nested resources to this method.
Try returning where you want to map it to rather than forward:

```
@Controller
public class MainViewController {

    @RequestMapping("/")
    public String indexPage() {
        return "index";
    }

    @RequestMapping("/application/**")
    public String apppplicationContext() {
        return "index";
    }
}

```