Sign up ×
Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute:

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?

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.