---
title: "How to configure base url for all requests using HTMX? - Stack..."
description: "!https://stackoverflow.com/questions/69456875/how-to-configure-base-url-for-all-requests-using-htmx"
date: 2024-12-30
published: true
tags:
  - dev
  - htmx
  - thought
  - webdev
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://stackoverflow.com/questions/69456875/how-to-configure-base-url-for-all-requests-using-htmx" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">External Link</div>
      <div class="embed-card-meta">stackoverflow.com</div>
    </div>
  </a>
</div>


Today I learned how to configure the baseurl for htmx using the <base> tag.  This is pretty handy to be able to configure different baseurls.

``` html
  <base href="<scheme>://<netloc>/api/v1/">
  <button hx-post="clicked"
       hx-trigger="click"
       hx-target="#parent-div"
       hx-swap="outerHTML">
    Click Me!
  </button>
```
