No need to make it verbose. Also multiple var statements.

```js
function redirect() {
if (location.hostname !== 'localhost') {
return;
}

var baseUrl = 'http://todomvc.com',
+      fragments = location.pathname.split('/'),
+      newPath = fragments.reduce(function (x, y) {
+        if (x === 'todomvc') {
+          return y;
+        }
+        return x + '/' + y;
+      });
+    location.href = baseUrl + newPath;
}
```