<html> <head> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script type="text/javascript"> function UrlExists(url, cb){ jQuery.ajax({ url: url, dataType: 'text', type: 'GET', cache: false, complete: function(xhr){ if(typeof cb === 'function') cb.apply(this, [xhr.status]); } }); } UrlExists('https://r3-core.pages.uni.lu/howto-cards-internal/index.html', function(status){ var s = window.location.href; var pathArray = s.split('?'); // cut the query if it exists if (pathArray.length > 0) { sub = pathArray[1]; } else { sub = ''; } if(status === 200){ // internal pages if (sub.length > 0) { UrlExists('https://r3-core.pages.uni.lu/howto-cards-internal/stable/internal/'+sub, function(status){ // redirect if card is actually internal and exists if (status == 200) { window.location.href = 'https://r3-core.pages.uni.lu/howto-cards-internal/stable/internal/'+sub; } else { window.location.href = 'https://r3-core.pages.uni.lu/howto-cards-internal/stable/external/'+sub; } }); } else { window.location.href = 'https://r3-core.pages.uni.lu/howto-cards-internal/stable/'+sub; } } else { // external pages if (sub.length > 0) { sub = 'external/'+sub; } window.location.href = 'https://r3.pages.uni.lu/howto-cards/stable/'+sub; } }); </script> </head> <body> <p> Please follow to <a href="https://r3.pages.uni.lu/howto-cards/stable">https://r3.pages.uni.lu/howto-cards/stable</a>! </p> </body> </html>