I know how to go to link / url / address, like;

```
window.location = "www.example.com/index.html";

```

or

```
document.location.href="www.example.com/index.html";

```

But suppose I want to navigate from `index1.html` to `index2.html`, how can i achieve this without providing the `www.example.com/` prefix? Please don't suggest that I set `www.example.com/` in a global variable / constant. The address may change to `www.example2.com/subfolder1/subfolder2/` to `www.examplea.com/`.... The mentioned methods works only in the case of **root** pages. I mean, providing `document.location.href="index.html";` will navigate the browser to `rootdomain/index.html`, even if I am staying in `rootdomain/section1/section2/somepage.html`. But I want to navigate to `rootdomain/section1/section2/index.html`

How can I achieve this by providing just the page name?