---
title: "hx-replace-url"
description: "Replaces the current URL in browser history"
---
The `hx-replace-url` attribute allows you to replace the current url of the
browser [location history](https://developer.mozilla.org/en-US/docs/Web/API/History_API).
## Syntax
```html
Go to My Account
```
The possible values of this attribute are:
1. `true`, which replaces the fetched URL in the browser navigation bar.
2. `false`, which disables replacing the fetched URL if it would otherwise be replaced due to inheritance.
3. A URL to be replaced into the location bar.
This may be relative or absolute, as per [
`history.replaceState()`](https://developer.mozilla.org/en-US/docs/Web/API/History/replaceState).
Here is an example:
```html
Go to My Account
```
This will cause htmx to snapshot the current DOM to `localStorage` and replace the URL `/account' in the browser
location bar.
Another example:
```html
Go to My Account
```
This will replace the URL `/account/home' in the browser location bar.
## Notes
* The [`HX-Replace-Url` response header](/reference/headers/HX-Replace-Url) has similar behavior and can override this attribute.
* The [`hx-push-url` attribute](/reference/attributes/hx-push-url) is a similar and more commonly used attribute, which creates a
new history entry rather than replacing the current one.