diff --git a/themes/bootstrap3/js/record.js b/themes/bootstrap3/js/record.js
index c7b3fb7b1ead92cb895e2e777b44a572b63d740b..17f989f5fad94f97c419cf4729d2754215adcba2 100644
--- a/themes/bootstrap3/js/record.js
+++ b/themes/bootstrap3/js/record.js
@@ -165,10 +165,11 @@ function registerTabEvents() {
 
 function ajaxLoadTab(tabid) {
   var id = $('.hiddenId')[0].value;
-  var parts = document.URL.split(path+"/");
-  var urlparts = parts[1].split("/");
+  var parts = document.URL.split("/");
+  // Grab the part of the url that is the Controller and Record ID
+  var urlroot = document.URL.match(new RegExp('/[^/]+/'+id+'/'));
   $.ajax({
-    url: path + '/' + urlparts[0] + '/'+id+'/AjaxTab',
+    url: path + urlroot[0] + 'AjaxTab',
     type: 'POST',
     data: {tab: tabid},
     success: function(data) {