# Aliases on root across languages in v0.155.0?

**URL:** <https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727>\
**Category:** support\
**Tags:** i18n, aliases\
**Created:** [February 15, 2026, 11:32pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727 "2026-02-15T23:32:10Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![duco](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@duco](https://discourse.gohugo.io/u/duco)\
**Post date:** [February 15, 2026, 11:32pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/1 "2026-02-15T23:32:10Z")

</div>

We want to change `defaultContentLanguageInSubdir` to `true`. It wasn’t set before. The consequence is, that `/places` is now `/en/places`. But we still want to support the old path. Actually we want to write a `alias.html` file with some JavaScript, that detects the current browser’s language and redirects to it.  
Since `v0.155.0`, it’s [not possible to define aliases from root anymore](https://discourse.gohugo.io/t/alias-paths-in-v0-155-0-and-later/56674).  
We basically want to do, what @jmooring describes in [this issue](https://discourse.gohugo.io/t/how-to-use-aliases-across-languages-in-v0-155-0/56667/4), but we don’t have an apache, but instead want hugo to render the `alias.html` for all currently existing paths, so the redirect redirects to the browser’s language.

So we have for example

- `/en/places`
- `/de/places`
- `/fr/places`

and we want to have a `/places` that redirects to one of those pages (the one of the browser’s language or `/en/places` as fallback).

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 15, 2026, 11:42pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/2 "2026-02-15T23:42:37Z")

</div>

> [@duco](#):
>
> but we don’t have an apache

How are you hosting your production site?

---

<div class="post-metadata">

**Author:** ![duco](https://avatars.discourse-cdn.com/v4/letter/d/b782af/32.png) [@duco](https://discourse.gohugo.io/u/duco)\
**Post date:** [February 15, 2026, 11:45pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/3 "2026-02-15T23:45:30Z")

</div>

It’s done as a service by KDE. I don’t know what they use. We provide the static files and they host the static files. So we need static redirect html files generated by hugo with the `alias.html` template or something similar.  
Here is [the change I tried](https://invent.kde.org/websites/endof10-org/-/merge_requests/1261/diffs#47b25ceaedefffa26f1ffe59a59a12c9a9da64f7). Besides the pipeline not building, I realized that the old aliases are removed. Would be happy to find a working solution.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [February 16, 2026, 12:43am UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/4 "2026-02-16T00:43:34Z")

</div>

> [@duco](#):
>
> I don’t know what they use.

They use Apache.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/f/9/f9c0819411af483d84eb6bd1b81a319fb3dad872.png)

Run an experiment. Create an `.htaccess` file in your `static` dir that redirects `/foo` to a valid page and see what happens. Presuming you get a small experiment to work, then you can get creative with language detection…

```htaccess
RewriteEngine On
RewriteBase /

# Skip language redirects for the css and js folders, or png and ico files in the root
RewriteRule ^(css/|js/|[^/]+\.png$|[^/]+\.ico$) - [L]

# Do nothing if the url already starts with one of the supported language codes
RewriteRule ^(en|de|fr)(/|$) - [L]

# Redirect to the german section if the browser's first language is german
RewriteCond %{HTTP:Accept-Language} ^de([-|_|;]|,|$) [NC]
RewriteRule ^(.*)$ /de/$1 [R=302,L]

# Redirect to the french section if the browser's first language is french
RewriteCond %{HTTP:Accept-Language} ^fr([-|_|;]|,|$) [NC]
RewriteRule ^(.*)$ /fr/$1 [R=302,L]

# Fall back to the english section for all other visitors
RewriteRule ^(.*)$ /en/$1 [R=302,L]

```

…or something.

---

<div class="post-metadata">

**Author:** ![shred](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@shred](https://discourse.gohugo.io/u/shred)\
**Post date:** [April 2, 2026, 9:43am UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/5 "2026-04-02T09:43:26Z")

</div>

I have a similar issue like the original author. However, I am using nginx instead of apache.

I use an `alias.html` template with a javascript that matches all available languages with the browser languages by user’s preference, and then redirects to the correct home page (or the home page of the configured default language).

The charme of this solution was that it’s just a html file that is put to the web server. It doesn’t matter what web server software is used (apache, nginx, whatever), and it also doesn’t involve manual changes to the server’s host configuration.

If I see correctly, starting with 0.155.0 there is no such “pure file” solution anymore.

I am certainly not the only one who uses `defaultContentLanguageInSubdir`, and I wonder why Hugo does not provide an out of the box “language forwarder” solution for that, that would substitute the `alias.html` file (which was a bit hackish anyway).

To be honest, I’m at a loss now. What else can I do to automatically forward to the browser language’s home page?

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 2, 2026, 1:47pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/6 "2026-04-02T13:47:22Z")

</div>

I don’t understand the problem. Perhaps you could provide an example.

---

<div class="post-metadata">

**Author:** ![shred](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@shred](https://discourse.gohugo.io/u/shred)\
**Post date:** [April 2, 2026, 3:54pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/7 "2026-04-02T15:54:34Z")

</div>

I have a multi-language site with `defaultContentLanguageInSubdir: true` and `content/de/…`, `content/en/…` etc.

I also have a file `themes/mytheme/layouts/alias.html`. It contains a JS that checks `navigator.languages` and matches the browser’s language preferences with the available languages, then forwards to the respective language.

If I understood the OP correctly, starting with 0.155.0 this `alias.html` trick won’t work anymore. So I wonder how I can now implement a custom site that redirects from the root `index.html` to the home page of the browser’s language.

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [April 2, 2026, 3:55pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/8 "2026-04-02T15:55:39Z")

</div>

> [@shred](#):
>
> won’t work anymore

Have you tried it?

---

<div class="post-metadata">

**Author:** ![shred](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@shred](https://discourse.gohugo.io/u/shred)\
**Post date:** [April 2, 2026, 4:04pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/9 "2026-04-02T16:04:48Z")

</div>

Good point. Fedora still provides 0.152.2. I downloaded 0.159.2 now, and it still works. I’m sorry for the noise.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [April 4, 2026, 4:04pm UTC](https://discourse.gohugo.io/t/aliases-on-root-across-languages-in-v0-155-0/56727/10 "2026-04-04T16:04:50Z")

</div>

Closed on April 4, 2026, 4:04pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
