Maybe it's not the best solution, but to do a generic implementation without change magento URL structure I add this on index.php
to make a redirect to http://mysiteurl/
if the user go to http://mysiteurl/user/ABC/
$url = "http://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
$get = '';
$first = true;
// create get string
foreach ($_GET as $key => $value) {
$get .= $first ? '?' : '&';
$get .= $key . '=' . $value;
$first = false;
}
// remove get from url
$url = str_replace($get, '', $url);
preg_match("/user.*/", $url, $pregMatchUser);
if($pregMatchUser) {
$url = preg_replace("/user.*/", '', $url);
// add get to url
$url .= $get;
header('Location: ' . $url);
exit();
}
And then create a fake URL with JavaScript, using window.history.replaceState
:
var url = window.location.toString();
var userGroupUrl = 'user/' + App.userGroup + '/';
var newUrl, index = url.indexOf("?");
if(index == -1) {
newUrl = url[url.length - 1] == '/' ? url + userGroupUrl : url + '/' + userGroupUrl;
} else {
newUrl = url.replace('?', userGroupUrl + '?');
}
window.history.replaceState({}, document.title, newUrl);
Of course, if you do this you will not be able to use /user/
in your URL for another thing.