diff --git a/app/assets/javascripts/discourse/routes/discourse_location.js b/app/assets/javascripts/discourse/routes/discourse_location.js index 82dcd003167..26fbd0b6f11 100644 --- a/app/assets/javascripts/discourse/routes/discourse_location.js +++ b/app/assets/javascripts/discourse/routes/discourse_location.js @@ -174,6 +174,13 @@ Ember.DiscourseLocation = Ember.Object.extend({ rootURL = rootURL.replace(/\/$/, ''); } + // remove prefix from URL if it is already in url - i.e. /discourse/t/... -> /t/if rootURL is /discourse + // this sometimes happens when navigating to already visited location + if ((rootURL.length > 1) && (url.substring(0, rootURL.length + 1) === (rootURL + "/"))) + { + url = url.substring(rootURL.length); + } + return rootURL + url; },