0

In my AngularJS app with ui.router the parameter in the URL is interpreted as path if there is a trailing slash.

What works:

http://example.com/product/123

What does not work:

http://example.com/product/123/

In the console I see that AngularJS is looking for all files in http://example.com/product/123/ rather in http://example.com/product

Google tells there is an option $urlMatcherFactory.strictMode(false) I don't have an idea how to get it to work. And still I am not sure if this would help.

Anyone with similar experiences?

user2113177
  • 350
  • 3
  • 16

1 Answers1

0

I had no luck with $urlMatcherFactory.strictMode(false) and I think that a mixture of a vhost alias and a conditional htaccess RewriteBase caused some conflict that I was not able to figure out within five hours.

What I now did, and this works well:

On the very top of the index.html I put this script:

var url = window.location.href;
if (url.slice(-1) == '/') {
    window.location.href = url.substring(0, url.length - 1);
}

So in case a user or browser adds a trailing slash, the page reloads without the trailing slash.

That's fine for know, still hoping to catch the culprit and fix it someday instead of sailing around it.

user2113177
  • 350
  • 3
  • 16