location.pathname
The pathname property can be set with new values that alter the current URL.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<script>
location.pathname = "mydir";
</script>
</body>
</html>